Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete file from network after using FileUpload control

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
I have an application that uses the file upload command to find a file on our network and copy it to another destination.

The users want to have the original file deleted now after it gets copied. That seemed simple enough by using the File.Delete method.

However, the path of the original file may be a mapped path and not the actual or relative path. Is there anyway to get that relative path name from the FileUpload control?

I am totally stuck.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
could you provide an example? This would help clarify the problem.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
1) The FileUpload button is clicked.
2) The user navigates to where the file is located.
3) They select the file and that path is stored in the text box part of the FileUpload control.
4) The user clicks a button and the file is copied to a destination based on some drop downs that are choosen with a new name.
5) The final step is to delete the original file which I tried to do with a File.Delete command using the value that was in the text box of the FileUpload text box.

The problem is that the path that the user navigates to in step 2 could have been mapped and given any drive name. So a user may have H:\Filename.pdf but the actual path is \\profiles\users\lcjohnson\Filename.pdf.

Does that help?

Thanks for responding.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Yes.
Once the server receives the file it does not care about it's origins. even though this is an intranet app. The system is a web app (inter or intra doesn't matter). the server should not be able to control actions on the client's box.

there are some options.
1. create a client application to manage local files (and the remote file is consider local in this context). this could be done with activeX or sliverlight.

2. create a mapping service for the service which can translate drive letters to absolute paths.
the crudest method: use a dictionary with letters as the key and paths as the value.
another, more complex approach would be to parse the user's logon script to find the drive and associated path.
Or, if the information is stored in AD, query AD using DirectoryServices to get the information.


Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top