I upload image using Dropzone. I need to send some other values via that(Some text values).In my scenario i need to send Product Name to the controller(pls see some comment in code)
Image successfully comes to the Controller's side,when button click.
HTML Code :
<input type="text" name="text" id="txtprod" class="form-control" />
<div id="dropzonffe" style="width: 55%; margin-left: 25%">
<form action="~/Admin/SaveProducts" class="dropzone" id="dropzoneJsForm"></form>
</div>
jQuery Code :
<script type="text/javascript">
Dropzone.options.dropzoneJsForm = {
autoProcessQueue: false,
init: function () {
var submitButton = document.querySelector("#btnSubmit");
var myDropzone = this;
submitButton.addEventListener("click", function () {
var ProductName = $("#txtprod").val();//<-- I want to send this Productname to the controller also.
myDropzone.processQueue();
});
}
};
</script>
My Controller :
public ActionResult SaveProducts () {
bool isSavedSuccessfully = false;
foreach (string fileName in Request.Files) {
HttpPostedFileBase file = Request.Files[fileName];
isSavedSuccessfully = true;
}
return Json (new { isSavedSuccessfully, JsonRequestBehavior.AllowGet });
}
I need to pass the Product Name to the controller. How can I do it ?