weixin_33713503 2017-05-03 14:55 采纳率: 0%
浏览 266

iOS上的JS formdata Chrome

I'm trying to upload images to my server from a WebApp. I'm using Formdata to prepare my data:

var dataView = new DataView(savedImage.value.data);
var blob = new Blob([dataView], { type: savedImage.value.type });

var file = new File([blob], savedImage.value.filename);

var fd = new FormData();
fd.append('filename', obj.filename);
fd.append('data', file);
fd.append('guid', obj.guid);
fd.append('filepath', obj.filepath);

And then I use Jquery to send it:

return $.ajax({
    type: 'POST',
    data: fd,
    processData: false,
    contentType: false,
    url: url,
    async:true,
})

This however does not work on Chrome for iOS(10.3) I don't even get any errors. Can anyone verify this behavior and an alternative way to accomplish this?

This works on Chrome for Desktop

EDIT 1
It seems that it is the creating of a file from a blob that is not supported in Chrome for iOS. Anyone have any experience with this?

Also can anyone tell me why on CanIUse and other sites, there are no specific Chrome for iOS category?

  • 写回答

1条回答 默认 最新

  • weixin_33693070 2019-03-24 00:41
    关注

    Might be too late, but just for anyone else who has the same issue. I had the same problem and fixed by formData.append Blob instead of a File.

    评论

报告相同问题?