2013-07-03 1 views
8

phonegap에서 html 파일 속성을 사용하는 방법은 무엇입니까? 그래서 내 안드로이드 장치에서 모든 .txt 파일을 탐색하고 서버에 업로드 할 수 ??phonegap에서 입력 파일을 사용하는 방법은 무엇입니까?

나는 폰갭 문서의 파일 전송 방법을 읽을 수는 있지만 단지 url.But을 통해 서버에 파일을 업로드 할 수 있음에 따르면처럼 정상적인 방법으로 가능하다 :이 바라 보았다

<input type=file /><button>upload</button> 

input type="file" accept="image/*" doesn't work in phone gap? 링크가 있지만 이미지에만 표시됩니다.

하지만 텍스트 파일을 업로드하는 방법은 무엇입니까?

어떤 도움 ??

아무도 답변을 드릴 수 있습니까?

답변

-1

Phonegap에서 입력 파일을 사용할 수 없습니다. 그것은 지원되지 않습니다. 당신은 이런 식으로 뭔가를 할 필요 MIME 타입의

function uploadDatabase(callback) { 
// file.entry accessible from global scope; see other tutorial 
var filepath = file.entry.fullPath, 
    uploadOptions = new FileUploadOptions(), 
    transfer = new FileTransfer(), 
    endpoint = "http://facepath.com/payload"; 

uploadOptions.fileKey = "db"; 
uploadOptions.fileName = "database.db"; 
uploadOptions.mimeType = "text/plain"; 

transfer.upload(filepath, endpoint, transferComplete, 
         transferError, uploadOptions); 

}

나는이 대답을 썼다 파일

+0

phonegap 2.4 이후에 사용할 수 있습니다. – jcesarmobile

-1

의 유형을 넣어 "당신은 폰갭에 입력 파일을 사용할 수 없습니다 그것은 지원 아니에요.. ". 해결책 확인 https://stackoverflow.com/a/13862151/1853864

+0

죄송합니다. 나는 오직 이미지만을 찾고있다. sdcard에 저장된 파일을 서버에 업로드하고 싶습니다. 내가 sdcard에서 모든 txt 파일을 탐색하고 서버에 업로드 찾아보기 옵션을 원하는 뜻. 전화 걸기에 가능합니까 ?? 아니면 다른 방법? – SSS

+0

이미 https://github.com/phonegap/phonegap-plugins/tree/master/Android/FileUploader를 시도해 보셨습니까? –

관련 문제