如何使用另一个输入表单创建 android cordova 图像上传

How to create android cordova image upload with another input form

我正在使用 Cordovaframework7 设置一个新应用程序,我想创建一个包含 photo/image-from-camera 和输入表单作为描述的表单和 name-file .

我已成功调用相机功能从androidphone拍照,但我需要将phone的图像临时位置发送到输入值并提交表单。

那么当我点击提交按钮时,我从哪里开始提交带有图像数据、名称和描述的表单。

试试这个

navigator.camera.getPicture(cameraSuccess, cameraError);

// success
function cameraSuccess(file_uri) {
  window.resolveLocalFileSystemURL(file_uri,
    function(fileEntry) {
        // fileEntry will have file name and file native URL
    });
}

// error
function cameraError(imageData) {
  // on error
}

Make sure camera destinationType is set to FILE_URI