프로세스를 자동으로 수행하기 위해 HTML5 FileSystem을 사용하여 파일 입력에서 가져온 파일 대신 URL (예 : http://example.com/doc.pdf)이 포함 된 원격 파일을 추가하려고합니다. ... 나는 (파일 입력을 추가) 우려 로컬 파일을 발견 ...리모트 파일이있는 HTML5 파일 API
을
모든 예제를 하나 개 이상의 문서가)하지만 난 과정에 대해 아무것도 발견되지 않았다 내가 당신에게 몇 줄을 제공 내 코드 :
window.requestFileSystem(TEMPORARY, 1024 * 1024 * 10, function(fs) {
FS_ = fs;
addRemoteDocuments();
}, errorCallback);
function addRemoteDocuments(){
var docList = [ "http://cpbdev/html5tests/pdf/tarifs.pdf", "http://cpbdev/html5tests/pdf/tarifs1.pdf", "http://cpbdev/html5tests/pdf/tarifs2.pdf", "http://cpbdev/html5tests/pdf/tarifs3.pdf", "http://cpbdev/html5tests/pdf/tarifs4.pdf" ];
for (var i = 0, doc; doc = this.docList[i]; ++i) {
// Capture current iteration's file in local scope for the getFile() callback.
(function(f) {
FS_.root.getFile(getName(doc), {create: true, exclusive: true}, function(fileEntry) {
fileEntry.createWriter(function(fileWriter) {
fileWriter.onwriteend = function(e) {
console.log('Write completed for doc '+i);
};
fileWriter.write(GET_REMOTE_FILE(doc));
}, errorCallback);
}, errorCallback);
})(doc);
}
readDirectories();
}
function GET_REMOTE_FILE(doc){
//Impossible to find a way to get File (with possibility to use file.name and others properties)
}
아마도 숨겨진 파일을 시뮬레이션 한 클릭으로 볼 수 있습니다. 전자 입력
I 원격 파일과 파일 시스템에 대한 문서 찾기가 어렵 기 때문에 누군가가 나를 도울 수 있기를 바랍니다이 ...
감사합니다 모두가
를 :) (그것은 ... 원격 파일을 추가 할 수 있다면)Brice.
무엇을하려고합니까? 파일 API를 통해 원격 파일을 다운로드 하시겠습니까? – mpm
로컬 파일 시스템에 원격 파일을 추가하고 싶습니다. (나중에 오프라인으로 액세스 할 수 있습니다.) – Pouki