Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
Iam uploading the file.

When page is gets refreshing my fileupload is clearing.

I write the below code in page load but it is not working.

FileUpload1.Attributes.Add("Value",FileUpload1.FileName);

or


Session["path"] = FileUpload1.FileName;




give me suggestions to clear the problem.

[EDIT] oops.... i wants to clear it once upload complete....Yaar! but on page refresh its again showing hasfile true...??? [/EDIT]
Posted
Updated 19-Dec-11 5:55am
v3
Comments
Uday P.Singh 25-Jul-11 7:17am    
what are you trying to achieve?

You can't retain the value of a file upload control, it will be empty every time the page is rendered. Why do you want to retain it's value ?
 
Share this answer
 
Comments
Member 7932936 25-Jul-11 8:00am    
because i don't want to upload the file many times when page gets refreshed
[no name] 25-Jul-11 14:24pm    
The file does not get uploaded when the page is refreshed, it is uploaded only when the page is submitted, that is why it gets cleared after a submit.
you cant do that. once the page is reloaded it will lose the file name
 
Share this answer
 
Use enctype="multipart/form-data" in form tag.

<form id="form1" runat="server" enctype="multipart/form-data"> This maintain your value.
 
Share this answer
 
Hi,

you can store that information in Session variable once you get in your Fileuploader control.

hope that will be helpful.

thanks
-amit
 
Share this answer
 

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