FileUpload in C# does not get file when click Upload button
Posted on 2010-11-17
I have coded an asp page into a site now using a master page. The FileUpload control worked fine on a regular asp page when clicking a button but when added into site it does not work. I've recently inherited this site to build and revise so I'm still getting familiar with it's inner workings.
I've added the following code just to the .aspx page in the site - this does display the message when clicking the uploadbutton after selecting a file to upload. I do get the "Nothing loads!" message and the FileUpload path that was browsed is gone.
<script runat="server" type="text/c#">
protected void Button1_Click(object sender, EventArgs e)
lblMessage.Text = FileUpload1.PostedFile.FileName;
lblMessage.Text = "Nothing loads!";
Are there additional permissions or validations I will need to code for to make this upload a file?
Any suggestions are welcome?
Thanks in advance.