Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

File uploads not working. Library methods changed in 2.0.

$
0
0

In my 1.1 app I used this method when saving a IFormFile:

foreach (IFormFile source in files)
            {
                string navn = ContentDispositionHeaderValue.Parse(source.ContentDisposition).FileName.Trim('"');

                var filename = this.EnsureCorrectFilename(navn);

                using (FileStream output = System.IO.File.Create(this.GetPathAndFilename(filename)))
                    await source.CopyToAsync(output);
             }

It worked perfectly untill I upgraded my app to 2.0. Now the Trim method don't take any arguments. Even If I just use Trim().ToString(); It can't convert to string properly.

What is going on here? 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>