whodares
whodares

Reputation: 696

jquery image upload in form via drag and drop

I'm currently working in asp.net mvc 4. I'm building an application for the latest browsers. At first, I used for my uploading. This worked fine. Then my employer decided that it had to work via drag and drop. So that's where I'm stuck right now.

I found a nice script online and made some minor mods to it. I steered clear of the upload functionality though. I did remove the upload button. This is the script I'm talking about: http://www.inserthtml.com/2012/08/file-uploader/ I did tweak the uploaded image a little bit while trying out stuff. Right now it's

('#dropped-files').append('<div class="image" name="picture" id="Picture" style="left: ' + z + 'px; background: url(' + image + '); background-size: cover;"> </div>');

The method I' using to handle the upload is the following:

[HttpPost]
public ActionResult MyMethod(String authorEmail, string buyerEmail, HttpPostedFileBase picture,
                                                string comments, int legalUsageCategoryId)

The picture variable is never filled out, unless I use type="file". Seeing as the image only has to be uploaded when the form is submitted, how could I best handle this?

Upvotes: 1

Views: 3604

Answers (1)

Omu
Omu

Reputation: 71238

ProDinner has this

here's the a video demo of drag and drop upload: http://youtu.be/12tePYmNsoM?hd=1

you can download it from here: http://prodinner.codeplex.com

and try it live here: http://prodinner.aspnetawesome.com/meal

Upvotes: 2

Related Questions