Click here to Skip to main content
16,019,018 members

Comments by mh20005@hotmail.com (Top 8 by date)

mh20005@hotmail.com 22-Aug-14 16:01pm View    
http://forums.asp.net/t/1615914.aspx?asyncFileUpload+how+to+get+new+FileName+after+uploda

same Problem
mh20005@hotmail.com 22-Aug-14 15:56pm View    
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
string Id;
Id = DateTime.Now.ToString("yyyyMMddTmmhhssfff");
string myMap = MapPath("~/").ToLower();
Random r = new Random();
int next = r.Next(0, 999);
string ImageName = AsyncFileUpload1.PostedFile.FileName;

string sImageFileExtension = ImageName.Substring(ImageName.LastIndexOf(".")).ToLower();
if (sImageFileExtension == ".gif" || sImageFileExtension == ".png" || sImageFileExtension == ".jpg" || sImageFileExtension == ".jpeg" || sImageFileExtension == ".bmp")
{
string ImageSaveURL = myMap + "Images/" + Id + next + sImageFileExtension;

AsyncFileUpload1.PostedFile.SaveAs(ImageSaveURL);

}
}


this code to save the image Ok

now how can i save the image new name in database use another event?
mh20005@hotmail.com 22-Aug-14 15:44pm View    
i get the old file name not new file name
mh20005@hotmail.com 22-Aug-14 15:33pm View    
I have a form to fill in personal data and Upload own image
Asyncfileupload used to select the picture and in the void AsyncFileUpload_UploadedComplete
Save the file in new name

Now when the user ends of the mobilization of all form and presses the save button to save data , i save every thing in database I can not get the new name to save it.
mh20005@hotmail.com 22-Aug-14 15:23pm View    
how i do that?