Here is the code that I am currently using:
var frontPic = e.target.files[0]
var frontPicName = frontPic.name
var salonId=$("#salonId").val()
upload = new Upload(frontPicName, salonId)
upload.resize(frontPic)
To invoke the code above:
function Upload(filename, salonId){
var form = new FormData()
form.append("filename", filename)
form.append("salonId", salonId)
};
Upload.prototype.resize = function(file){
$.canvasResize(file,
{
width: 400,
height: 0,
crop: false,
quality: 100,
callback: function (data)
{
alert(data)
// Add file data
this.form.append("file", $.canvasResize('dataURLtoBlob', data));
$('body').css("background", "url("+data+")")
}
});
}
While my alert(data) seems to be functioning correctly, the resizing process itself appears to be executing smoothly.
However, an error message stating this.form is undefined
pops up for the line
this.form.append("file", $.canvasResize('dataURLtoBlob', data));
What would be the correct syntax in this case?