Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Cordova摄像头上载的文件已损坏-但使用的输入类型为“;文件";可以_Javascript_Html_Cordova_File Upload_Cordova Plugins - Fatal编程技术网

Javascript Cordova摄像头上载的文件已损坏-但使用的输入类型为“;文件";可以

Javascript Cordova摄像头上载的文件已损坏-但使用的输入类型为“;文件";可以,javascript,html,cordova,file-upload,cordova-plugins,Javascript,Html,Cordova,File Upload,Cordova Plugins,我正在尝试使用预先签名的url将图像上载到aws s3。我希望允许用户从图像库/实时捕获中进行选择 代码如下: navigator.camera.getPicture(file => { // file = file:///data/user/0/app.bundle.id/cache/icon.png?1678918325411 }) 现在,当使用axios将此文件传递给aws s3时,实际文件已损坏,无法打开 执行相同操作时,使用输入type=“file”/>它工作正常,图像加载

我正在尝试使用预先签名的url将图像上载到aws s3。我希望允许用户从图像库/实时捕获中进行选择

代码如下:

navigator.camera.getPicture(file => {
  // file = file:///data/user/0/app.bundle.id/cache/icon.png?1678918325411
})
现在,当使用axios将此文件传递给aws s3时,实际文件已损坏,无法打开

执行相同操作时,使用
输入type=“file”/>
它工作正常,图像加载成功:

const changed = e => {
  const [ file ] = e.target.files
}
<input type="file" onChanged={changed} />
const changed=e=>{
const[file]=e.target.files
}
我尝试接收使用base64选择/上传的图像数据,并按原样发送,但无效

那么我如何正确上传它呢