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.

    评论

    报告相同问题?

    悬赏问题

    • ¥15 pom文件依赖管理,未找到依赖
    • ¥15 现在后端返回给我一堆下载地址,都是一个视频切片后的,如何在uniapp安卓环境下将这些分片的视频下周并且合并成原始视频并下载到本地。
    • ¥15 Unity导出2D项目运行时图片变成马赛克
    • ¥15 关于communitytoolkit.mvvm的生成器得到的代码看起来没有被使用的问题
    • ¥15 matlab中此类型的变量不支持使用点进行索引
    • ¥15 咨询第六届工业互联网数据创新大赛原始数据
    • ¥15 Pycharm无法自动补全,识别第三方库函数接收的参数!
    • ¥15 STM32U575 pwm和DMA输出的波形少一段
    • ¥30 android百度地图SDK海量点显示标题
    • ¥15 windows导入environment.yml运行conda env create -f environment_win.yml命令报错