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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Empty posted file when using drag and drop

Thread ID:

Created:

Updated:

Platform:

Replies:

146314 Jul 31,2019 01:51 AM UTC Aug 5,2019 09:13 AM UTC ASP.NET MVC - EJ 2 7
loading
Tags: Uploader
Juan Jiminez
Asked On July 31, 2019 01:51 AM UTC

I'm using latest MVC version (17.2500.0.39) of the uploader following the image preview sample https://ej2.syncfusion.com/aspnetmvc/Uploader/ImagePreview#/material.

Posted file works when I use the browse button, however, when I use the drag and drop feature I can see the image preview but no file data is posted, all I get is an empty "application/octet-stream" when checking System.Web.HttpContext.Current.Request.Files["Avatar_File"].

This is my setup:

  Dictionary<string, object> htmlAttr = new Dictionary<string, object>();

  htmlAttr.Add("name", "Avatar_File");
  htmlAttr.Add("class", "form-control");

@Html.EJS().Uploader("uplAvatar").AutoUpload(false).Multiple(false).AllowedExtensions("image/*").Selected("OnFileSelect").HtmlAttributes(htmlAttr).Render()

I'm attaching the Javascript part for reference.

Attachment: uploader_1b52143b.zip

Narayanasamy Panneer Selvam [Syncfusion]
Replied On August 1, 2019 01:54 AM UTC

Hi Juan, 
Thanks for contacting Syncfusion support. 
We have checked the reported issue. We have prepared the image preview sample and it is working fine in drag and drop and manually upload the uploader. By using the shared code snippet, we have created sample. 
Also, we have taken video for drag and drop the files.  
 
If still you are facing problem kindly let us know with more details. So that we can provide prompt solution as earlier. 
 
Regards,  
Narayanasamy P.  


Juan Jiminez
Replied On August 1, 2019 01:51 PM UTC

Hi Narayanasamy,

Thanks for the sample. 

I forgot to mention I'm posting the uploaded file as part of a form with an ajax call, like:

var formdata = new FormData('myform').get(0));


            $.ajax({
                type: "POST",
                url: '/Save',
                data: formdata,
                dataType: 'json',
                processData: false,
                contentType: false,

                success: function (data) {                  
                                console.log(''saved'');                                  
                },
                error: function (xhr) {

                    console.log(''error'');       
                }

            });

Narayanasamy Panneer Selvam [Syncfusion]
Replied On August 2, 2019 01:28 PM UTC

Hi Juan,  
Most welcome. 
We have checked the reported scenario. we have customFormData support in uploader, in that you can additional data to controller. So, we suggest you to use our customFormData for sending additional data to controller as mentioned below, 
function onUploading(args) {
args.customFormData = [{ 'File': args.fileData.name }];
}
 
 
Receives this file name in controller as mentioned below, 
var file = HttpContext.Request.Form["File"]; 
 
 
Regards, 
Narayanasamy P. 


Juan Jiminez
Replied On August 2, 2019 04:16 PM UTC

Hi Narayanasamy,

I don't need to pass in additional data, what I need is dropped files to be part of the form data on submission (not async upload), more like this sample is supposed to work https://ej2.syncfusion.com/aspnetmvc/documentation/uploader/form-support/.

Currently it does submit the file when I use the browse button but id doesn't work with drag and drop.

Best,

John Stemper
Replied On August 2, 2019 09:13 PM UTC

Juan,
I have found the same issue and have started a thread about it here. The response from Syncfusion was that it was  reproduced and they are expecting a fix in SP1.


John

Juan Jiminez
Replied On August 3, 2019 01:00 AM UTC

Juan,
I have found the same issue and have started a thread about it here. The response from Syncfusion was that it was  reproduced and they are expecting a fix in SP1.


John

Thanks John, I appreciate it.

Narayanasamy Panneer Selvam [Syncfusion]
Replied On August 5, 2019 09:13 AM UTC

Hi John / Juan, 

We appreciate your comments @John

As we promised earlier, we will include
remedy for this issue with upcoming Service-Pack1 release. Will intimate you once the SP1 release rolls out. We appreciate your patience until then.

 
Regards, 
Narayanasamy P. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon