Click here to Skip to main content
15,909,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have one difficulty.

What I am trying to do is this; I am trying to upload any file from local machine and save it in an application folder.
But when I have to try to upload file, the FileUpload control cannot get the file name.

The following code works fine in a simple page (without master):
if (FileUpload1.HasFile) 
{          
  String fileName = FileUpload1.FileName;
  savePath += fileName;                
  FileUpload1.SaveAs(savePath);                
  UploadStatusLabel.Text = "Your file was saved as " + fileName;
}            
else
{                
  // Notify the user that a file was not uploaded.
  UploadStatusLabel.Text = "You did not specify a file to upload."; 
} 

So, please give me suggestions & if possible the complete way of doing this.
Posted
Updated 11-Jan-11 21:42pm
v3
Comments
Sunasara Imdadhusen 12-Jan-11 2:43am    
please send whole code!!
Dalek Dave 12-Jan-11 3:42am    
Edited for Grammar and Readability.

1 solution

 
Share this answer
 
Comments
Sandeep Mewara 12-Jan-11 3:35am    
Good link! 5!
Dalek Dave 12-Jan-11 3:42am    
Good Link Mr Roy!
Anupama Roy 12-Jan-11 3:45am    
Thanks Sandeep,Thanks Dalek !a small correction not Mr,Mrs :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900