Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Sep 18th, 2018 59 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. TempFileName = Regex.Replace(vehicle.FileUpload.FileName, "[^a-zA-Z0-9_]+", "_", RegexOptions.Compiled);
  2. var directiveToUpload = Path.Combine(_hostingEnvironment.WebRootPath, "images\UploadFile");
  3.  
  4.     if (!System.IO.Directory.Exists(directiveToUpload))
  5.                         {
  6.                             System.IO.Directory.CreateDirectory(directiveToUpload);
  7.                         }
  8.     await SaveFileToServer(TempFileName);
  9.    
  10. async Task SaveFileToServer(string FileName)
  11.             {
  12.  
  13.                 if (vehicle.FileUpload.Length > 0)
  14.                 {
  15.                     using (var stream = new FileStream(Path.Combine(directiveToUpload, FileName), FileMode.Create))
  16.                     {
  17.                         await vehicle.FileUpload.CopyToAsync(stream);
  18.                     }
  19.                 }
  20.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top