I am trying to get canceling all uploads to work with client size resizing. I can get one or the other to work, but not both at the same time. I have been maintaining a stack of xhr objects in my add
method, but that requires calling data,submit()
directly. I have now changed my code to hook into fileuploadadd
and the resizing works great, but canceling only cancels one file (I assume the latest one).
This is what it currently looks like:
@addFile = (e, data) =>
if @validate(data)
this.transfers.push(data)
else
$result = $("<div class='error'>#{data.files[0].name} failed to upload. Files must be 5MB or less, and must be gif, jpg, or png format.</div>")
$messageContainer.append($result)
e.preventDefault()
$(input).fileupload
disableImageResize: /Android(?!.*Chrome)|Opera/.test(window.navigator && navigator.userAgent)
imageMaxWidth: 1024
imageMaxHeight: 1024
imageCrop: false
.bind('fileuploadadd', @addFile)