Wait till the file Save complete in Asp.net C# -


I have the process of uploading files in an asp.net c # application. I am using the code below to save the browse file on the path:

  this.fupUploadImage.SaveAs ("filepath");  

I have to wait for execution until the rescue process is over. Can any body suggest a good attitude?

Thanks in advance.

is a zero method so that you wrap the call and return a value when it ends < / P>

  int SaveFile {string filepath} {if (! System.IO.File.Exists (filePath)} {try {FileUpload1} .SaveAs (savePath); return1;} hold {} return 0 ;}}  

Then you can capture it like this

  if (savefile (@ "myPath / test.txt") & gt; 0) Save it properly!  

This is a contemporary approach to your problem. Wait for the end of the program savings process If you want to execute it in any other work in the background, you can call

  Task  T = Task.ru ((=) & Gt; SaveFile (@ "Mypath / Test."). Finish ((I) => gt; i & gt; 0? "SaveOc": "Saved");  
< P> Now the saved operation is executed in the background and in the end the result comes in input and you can use the code to handle your label "saveOk" and "safe" When opera Save succesfull or not.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -