I use

FileUpload.Filename = lbl1.text.ToString();
FileUpload.SaveAs(Server.MapPath("~/Photo/AllPhotoes/" + FileUpload.FileName));

and i got Error: Property or indexer 'System.Web.UI.WebControls.FileUpload.FileName' cannot be assigned. it is read only.


I want to save image with label name which is hidden. and it get new value each time.
how can i change image name with label name.

help me....

So the code should be,

FileUpload.SaveAs(Server.MapPath("~/Photo/AllPhotoes/" + lbl1.text));

Try the AsyncFileUpload from the AjaxControlToolkit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.