1

Apologies in advance if this is a dumb question but I'm struggling to get the look and feel I want whilst posting the data I need to the server: s

I've built a simple file upload page using Dropzone.js and am able to upload files to the server. I also want to pass a value from a drop down to the same action method but can only achieve this if my drop down is contained within my dropzone (which I don't want!)

My Page and HTML look like this: enter image description here

The class="dropzone" defines where the dropzone is and seems to be have to be attached to the action="~/Media/SaveUploadedFile" or the fallback class gets used instead and screws up the layout. So this code gives me the layout I want with the dropdown outside of the dropzone but does not pass the drop down value to my Action Method: (

What am I doing wrong?

Controller method:

public ActionResult SaveUploadedFile(string ContentDirectory)
Cù Đức Hiếu
  • 5,569
  • 4
  • 27
  • 35
user4907301
  • 83
  • 1
  • 4

1 Answers1

0

Try using Html.BeginForm. Place your dropdown inside of the @using tag.

@using (Html.BeginForm("SaveUploadedFile", "Media", FormMethod.Post, new { @class = "dropzone", enctype = "multipart/form-data" }))
{ 
    //Dropdown here

    <div class="fallback">
        <input type="file" name="file" />
        <input type="submit" value="Upload" />
    </div>
}

Here's a similar existing post for uploading files in MVC

Community
  • 1
  • 1
Ken Huynh
  • 78
  • 7
  • Thanks - Tried that and a few other similar variations but that just puts the drop down bang in the middle of the drop zone.. – user4907301 Mar 28 '16 at 22:58