PHP Snippet 1:
myDropzone.on("sending", function(file, xhr, formData) {
formData.append("fieldname1", $('field-name-1').val());
});
PHP Snippet 2:
var myDropzone = new Dropzone(".profile-image-upload",
{
paramName: "uploadfile",
url: "/API/PeopleAPI/EditAsync",
maxFiles: 1,
headers: getData(),
uploadMultiple: false,
autoProcessQueue: false,
maxFilesize: 20,
acceptedFiles: "image",
dictMaxFilesExceeded: "You can only upload 1 image",
dictDefaultMessage: "",
});
function getData() {
var data = {
//person
UserName: $('#UserName').val(),
AspNetUserID: '@Model.AspNetUserID',
Roles: $('#UserRoles').val(),
FirstName: $('#FirstName').val(),
Email: $('#Email').val(),
LastName: $('#LastName').val(),
Gender: $('#Gender').val(),
Password: $('#Password').val(),
//address
AddressLine1: $('#AddressLine1').val(),
AddressLine2: $('#AddressLine2').val(),
Town: $('#Town').val(),
RegionID: $('#RegionID').val(),
RegionName: $('#RegionID :selected').text(),
City: $('#City').val(),
CountyID: $('#CountyID').val(),
CountyName: $('#CountyID :selected').text(),
PostCode: $('#PostCode').val(),
__RequestVerificationToken: $('[name="__RequestVerificationToken"').val()
};
return data;
}