gpt4 book ai didi

ios - Cordova 3.5.0 FileError.NOT_FOUND_ERR(代码 :1) Error uploading files > 256MB

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:53 27 4
gpt4 key购买 nike

Cordova 3.5.0
FileTransfer 0.4.4
iPad 2 version 7.1.2
error: FileError.NOT_FOUND_ERR (Code:1)
Error uploading files iOS > 256MB

日志设备:

Jul 15 17:12:34 iPad-Sergej CueVu[119] <Warning>: THREAD WARNING: ['Camera'] took '18.839844' ms. Plugin should use a background thread.
Jul 15 17:13:24 iPad-Sergej CueVu[119] <Warning>: Error opening file file:///private/var/mobile/Applications/D51C7F13-09AE-42D3-A613-83D5005C55F2/tmp/trim.ED614CFF-CBE0-4A8C-82D2-E507F3DA9B0D.MOV: Error Domain=NSCocoaErrorDomain Code=256 "The operation couldnt be completed. (Cocoa error 256.)" UserInfo=0x1a978b60 {NSFilePath=/private/var/mobile/Applications/D51C7F13-09AE-42D3-A613-83D5005C55F2/tmp/trim.ED614CFF-CBE0-4A8C-82D2-E507F3DA9B0D.MOV, NSUnderlyingError=0x14dfa590 "The operation couldnt be completed. Cannot allocate memory"}
Jul 15 17:13:24 iPad-Sergej CueVu[119] <Warning>: FileTransferError {
code = 1;
source = "file:///private/var/mobile/Applications/D51C7F13-09AE-42D3-A613-83D5005C55F2/tmp/trim.ED614CFF-CBE0-4A8C-82D2-E507F3DA9B0D.MOV";
target = "https://myserver.com/my/mobile/uploadFile/t:153c52738326e2153c5273832ac7153c5273832eb0153c5273833298";
}
Jul 15 17:13:24 iPad-Sergej CueVu[119] <Warning>: THREAD WARNING: ['FileTransfer'] took '39.189209' ms. Plugin should use a background thread.
Jul 15 17:13:24 iPad-Sergej CueVu[119] <Warning>: THREAD WARNING: ['Notification'] took '67.596924' ms. Plugin should use a background thread.

代码:

function uploadVideo(meeting_id) {
var chargeBar = '';

navigator.camera.getPicture(
successGetFileFromCamera,
failGetFileFromCamera,
{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
mediaType: navigator.camera.MediaType.VIDEO
}
);

function successGetFileFromCamera(fileURI) {
uploadFileToServ(fileURI);
}

function failGetFileFromCamera(message) {
showError(message);
}

function uploadFileToServ(fileURI) {
alert(fileURI);
var options = new FileUploadOptions();
options.fileKey = "my_video";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/')+1);
options.mimeType="video/mp4";
var params = {};
params.meeting_id = meeting_id;
options.params = params;
options.chunkedMode = true;

var ft = new FileTransfer();
ft.onprogress = function(progressEvent) {
if(progressEvent.lengthComputable) {
updateProgress(Number(((progressEvent.loaded / progressEvent.total) * 100).toFixed(1)));
}
};

showProgress();

ft.upload(fileURI, encodeURI(window.cuevuHost + "/cuevu/mobile/uploadFile/t:" + window.cuevuToken), successUploadFileToServ, failUploadFileToServ, options);
}

function showProgress() {
$("#progress_window").popup('open');
$("#progress_window_content").html("<div id='chargeBar'></div>");
chargeBar = new Progress.bar({ id: "progress1", autoRemove: false, backgroundSpeed: 5, type: "charge", showPercentage: true});
chargeBar.renderTo(document.getElementById('chargeBar'));
$('.ui-popup-screen').off();
}

function updateProgress(value) {
chargeBar.update(value);
}

function closeProgress() {
$("#progress_window").popup('close');
}

function successUploadFileToServ(r) {
closeProgress();
data = $.parseJSON(r.response);
if(data.result == true) {
navigator.notification.alert('Video file has been successfully loaded', null, 'Upload file', null);
} else {
dataHaveError(data);
}
}

function failUploadFileToServ(error) {
closeProgress();
showError("File Transfer: Code = " + error.code);
}

}

请帮忙,是什么错误原因看不懂...

最佳答案

请将 uploadFileToServ 函数的实现更改为以下

function uploadFileToServ(fileURI) {
window.resolveLocalFileSystemURI(fileURI, function (fileEntry) {
fileEntry.file(function (fileObj) {
var fileName = fileObj.fullPath;

alert(fileName);
var options = new FileUploadOptions();
options.fileKey = "my_video";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/')+1);
options.mimeType="video/mp4";
var params = {};
params.meeting_id = meeting_id;
options.params = params;
options.chunkedMode = true;

var ft = new FileTransfer();
ft.onprogress = function(progressEvent) {
if(progressEvent.lengthComputable) {
updateProgress(Number(((progressEvent.loaded / progressEvent.total) * 100).toFixed(1)));
}
};

showProgress();

ft.upload(fileName encodeURI(window.cuevuHost + "/cuevu/mobile/uploadFile/t:" + window.cuevuToken), successUploadFileToServ, failUploadFileToServ, options);
}
}

关于ios - Cordova 3.5.0 FileError.NOT_FOUND_ERR(代码 :1) Error uploading files > 256MB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24806415/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com