-1

asyncFileUpload how to get a new File Name after upload complete to save new name in database asp.net c#

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.

Mike
  • 661
  • 7
  • 13

1 Answers1

0

it is a property in the control. In you event handler check the FileName property. The following code assumes your are checking the file size to to intercept any oversized files.

protected void AsyncFileUpload_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
{
    AsyncFileUpload upload = sender as AsyncFileUpload;
    if ((upload.PostedFile.ContentLength / 1000) <= 500)
    {
        string filename = upload.FileName;
        // save to the database here
    } 
}

Hope this helps :-)

Mike

Mike
  • 661
  • 7
  • 13