2

The file upload component from a 3rd party vendor does not work with my MVC 6 project. Therefore I built a very simple upload mechanism with standard asp.net components:

<form method="post" asp-action="Index2" asp-controller="Data" enctype="multipart/form-data">
    <input type="file" name="files" multiple />
    <input type="submit" value="Upload" />
</form>

This upload works fine. I receive the uploaded file in my POST-Method in the controller. However if I start the full featured upload component (dxFileUploader from DevExpress) I don't receive the file. My method in the controller will be called but the file collection is empty. In order to compare the two upload requests I created a Fiddler for both. The requests are very similar. Has someone an idea what's the problematic difference between the two requests?

marco birchler
  • 1,566
  • 2
  • 21
  • 45
  • 1
    Would you please provide the code of how you bind dxFileUploader and what code you have on the server to process file uploading? I've tried to download your file, but it returns something weird. – Gosha_Fighten Apr 18 '16 at 12:09

1 Answers1

2

@Marco, I know this is old, however, ensure that the binding in your controller is correct, meaning the parameter to your action matches the name of the component. I am using the dxFileUploader (version 16.1) with the following action:

public async Task<IActionResult> UploadProducts([FromForm]IFormFileCollection files){...}

And the following in my view :

$("#file-uploader").dxFileUploader({
        selectButtonText: "Select Product File",
        labelText: "",
        accept: "text/csv",
        uploadMode: "useForm",
        name: "files"
    });

I hope this helps.

Craig C
  • 21
  • 2