title: Can I set the Default folder for the FileUpload Control?
body: <p>I have a fileupload <code>&lt;asp:FileUpload id="FileUpload1" runat="server"&gt; &lt;/asp:FileUpload&gt;</code> that I want users to upload a file from a specific folder on our network.</p>
  
  <p>Is there a way to set the path to the folder so that when they click the browse button it will send them to: <code>\\Txsappblt016v\Shadow\</code>?</p>
  
  <p>Everyone with access to this drive will be able to access it.  So that is my first goal.</p>
  
  <p>My second goal is to not have this run on the client side, but server side, since the server has access to the folder but not all the useres will. Just to see if I can do this I'm using this code: </p>
  
  <pre><code>&lt;%@ Page Language="VB" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; 
  
  &lt;script runat="server"&gt;
  
    Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  
      ' Specify the path on the server to
      ' save the uploaded file to.
      Dim savePath As String = "c:\temp\uploads\"
  
      ' Before attempting to perform operations
      ' on the file, verify that the FileUpload 
      ' control contains a file.
      If (FileUpload1.HasFile) Then
        ' Get the name of the file to upload.
        Dim fileName As String = FileUpload1.FileName
  
        ' Append the name of the file to upload to the path.
        savePath += fileName
  
        ' Call the SaveAs method to save the 
        ' uploaded file to the specified path.
        ' This example does not perform all
        ' the necessary error checking.               
        ' If a file with the same name
        ' already exists in the specified path,  
        ' the uploaded file overwrites it.
        FileUpload1.SaveAs(savePath)
  
        ' Notify the user of the name the file
        ' was saved under.
        UploadStatusLabel.Text = "Your file was saved as " &amp; fileName
  
      Else
        ' Notify the user that a file was not uploaded.
        UploadStatusLabel.Text = "You did not specify a file to upload."
      End If
  
    End Sub
  
  &lt;/script&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;FileUpload Example&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
         &lt;h4&gt;Select a file to upload:&lt;/h4&gt;
  
         &lt;asp:FileUpload id="FileUpload1"                 
             runat="server"&gt;
         &lt;/asp:FileUpload&gt;
  
         &lt;br /&gt;&lt;br /&gt;
  
         &lt;asp:Button id="UploadButton" 
             Text="Upload file"
             OnClick="UploadButton_Click"
             runat="server"&gt;
         &lt;/asp:Button&gt;    
  
         &lt;hr /&gt;
  
         &lt;asp:Label id="UploadStatusLabel"
             runat="server"&gt;
         &lt;/asp:Label&gt;        
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx" rel="nofollow">Source</a></p>
  
  <p><a href="http://forums.asp.net/t/1273605.aspx" rel="nofollow">This forum</a> says it can't be done... </p>