We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Uploader posts null collection of files on MacOS, Safari even with Syncfusion version 20.3.0.61 - Provided sample does not work

Good morning,

Thank you for your prompt replies in this thread BUT your sample does NOT work on MacOS, Safari 16.1 (17614.2.9.1.13, 17614). Your sample is using Syncfusion.EJ2.AspNet.Core version 20.3.0.61 and still, when run, the collection of files posted to the controller is null.

Here is the controller code:

[HttpPost]
public async Task Index(UpdateTestViewModel model)
{
    string uploadsFolder = Path.Combine(hostingEnv.WebRootPath, @$"Content\Tests\Images");
    foreach (var fileToUpload in model.Images)
    {
        string filePath = Path.Combine(uploadsFolder, fileToUpload.FileName);
        using (FileStream fs = System.IO.File.Create(filePath))
        {
            await fileToUpload.CopyToAsync(fs);
        }
    }
    return View(model);
}

The above code works fine on Windows (Chrome browser). But on Safari, the error is:


System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=webapp1
StackTrace:
at webapp1.Controllers.HomeController.d__4.MoveNext() in HomeController.cs:line 36


Line 36 is:  

foreach (var fileToUpload in model.Images)

model.Images is null.


Any ideas?


Thank you very much in advance,




1 Reply 1 reply marked as answer

UD UdhayaKumar Duraisamy Syncfusion Team December 27, 2022 01:41 PM UTC

Dimitris, after validating the requirement on the latest updated sample, the sample has old version scripts. After updating the latest version scripts in the _Layout.cshtml page the reported issue does not occur.

Find the screenshot here:


Find the latest updated sample in the attachment:

Find the latest updated scripts in _Layout.cshtml:

<link rel="stylesheet" rel='nofollow' rel='nofollow' href="https://cdn.syncfusion.com/ej2/20.4.38/fabric.css"

          asp-fallback-rel='nofollow' rel='nofollow' href="~/css/ej2/fabric.css"

          asp-fallback-test-class="e-prevent-select"

          asp-fallback-test-property="user-select"

          asp-fallback-test-value="none"

          asp-suppress-fallback-integrity="true" />

 

    <script src="https://cdn.syncfusion.com/ej2/20.4.38/dist/ej2.min.js"

            asp-fallback-src="~/js/ej2/ej2.min.js"

            asp-fallback-test="window.ej"

            asp-suppress-fallback-integrity="true"></script>



Sample : https://www.syncfusion.com/downloads/support/forum/179489/ze/webapp1_cedc209d


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon