我正在使用以下代码:
var frontPic = e.target.files[0]
var frontPicName = frontPic.name
var salonId=$("#salonId").val()
upload = new Upload(frontPicName, salonId)
upload.resize(frontPic)
调用以下代码
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+")")
}
});
}
我的 alert(data) 似乎工作正常,所以实际的调整大小操作看起来很好。
但是我收到了this.form is undefined
该行的错误this.form.append("file", $.canvasResize('dataURLtoBlob', data));
什么是正确的语法?