You are wanting to control the directory location that the browse starts in and not the save path the file is uploaded to, correct?
I could be wrong but since the server never knows the file structure of the client machine, the developers of that control probably did not provide for that functionality.
dwfreeman
Member
566 Points
1114 Posts
Default folder for the FileUpload Control
Jun 10, 2008 10:02 PM|LINK
Is there a way to establish a default folder for the Fileupload control?
vinz
All-Star
126946 Points
17922 Posts
MVP
Re: Default folder for the FileUpload Control
Jun 10, 2008 10:08 PM|LINK
You need to set the location during uploading the files using the SaveAs method
http://msdn.microsoft.com/en-us/library/aa479405.aspx
http://support.microsoft.com/kb/323245
http://www.codeproject.com/KB/aspnet/fileupload.aspx#file
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
dwfreeman
Member
566 Points
1114 Posts
Re: Default folder for the FileUpload Control
Jun 10, 2008 10:33 PM|LINK
Actually, what I meant was to have the Browse button open explorer to a specific folder. Not necessarilly to the last one visited.
cdoloriert
Member
35 Points
25 Posts
Re: Default folder for the FileUpload Control
Jun 11, 2008 01:46 AM|LINK
Check this link and take a look at the code sample and you will find out how to set the path for that control.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.filecontent(VS.80).aspx
Hope this helps
dwfreeman
Member
566 Points
1114 Posts
Re: Default folder for the FileUpload Control
Jun 11, 2008 04:26 PM|LINK
I must be missing it. The only line in the sample that involves a path is
Dim savePath As String = "c:\temp\uploads\"
Changeing that value does not impact the file search folder.
Pandiya
Member
132 Points
39 Posts
Re: Default folder for the FileUpload Control
Jun 11, 2008 04:35 PM|LINK
By default, the requireRootedSaveAsPath attribute of the httpRuntime configuration element in the Web.config file is set to true, which means that
you need to provide an absolute path to save the file.
Happy Coding
Pandiya
kraznodar
Contributor
3332 Points
881 Posts
Re: Default folder for the FileUpload Control
Jun 11, 2008 04:43 PM|LINK
You are wanting to control the directory location that the browse starts in and not the save path the file is uploaded to, correct?
I could be wrong but since the server never knows the file structure of the client machine, the developers of that control probably did not provide for that functionality.
dwfreeman
Member
566 Points
1114 Posts
Re: Default folder for the FileUpload Control
Jun 11, 2008 07:37 PM|LINK
You are correct. I think you are the first person who understands the question. And you may be correct that it can't be done.
Vince Xu - M...
All-Star
80367 Points
6801 Posts
Re: Default folder for the FileUpload Control
Jun 13, 2008 03:37 AM|LINK
Hi,
I'm agreed with the above. The dufault value is due to the browser. FileUpload.Value can return the path on the client, but it is read only.
So it isn't available unless you can use JavaScript to modify the default directory of dialog box that needs support of the browser.
It refers to some security problem, so you had better give it up.
Hope it helps.