모바일 응용 프로그램에 두 가지 목표가 있습니다.Phonegap camera.getPicture 업로드시 문제가 발생했습니다.
a)는 휴대 전화의 카메라로 사진을 촬영하고 휴대 전화의 갤러리에서 사진을 선택하고 서버
내가 폰갭 및 포인트를 사용하고있다에 업로드) 서버
B에 업로드 "a"는 잘 작동합니다. 또한 "b".
문제 : 매 초마다 업로드가 실패하는 것처럼 보입니다. 내가 "a"점 또는 "b"점으로 시작하든 상관 없습니다. 또는 무작위로 결합.
결과 :
1. 성공
2.
3. 성공
4.
4. 실패 실패 등
여기
"A"지점 내 코드입니다 :
가function getImageCamera() {
navigator.camera.getPicture(uploadPhotoCamera, function(message) {
},{
targetWidth: 1200,
targetHeight: 900,
quality: 75,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA
}
);
}
및 점 "b":
function getImageGallery() {
navigator.camera.getPicture(uploadPhotoGallery, function(message) {
},{
targetWidth: 1200,
targetHeight: 900,
quality: 75,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
}
);
}
함수 uploadPhotoCamera 및 uploadPhotoGallery는 동일합니다.
12-14 22:44:15.303: W/FileTransfer(32613): Error getting HTTP status code from connection.
12-14 22:44:15.303: W/FileTransfer(32613): java.io.EOFException
12-14 22:44:15.303: W/FileTransfer(32613): at libcore.io.Streams.readAsciiLine(Streams.java:203)
12-14 22:44:15.303: W/FileTransfer(32613): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
12-14 22:44:15.303: W/FileTransfer(32613): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
12-14 22:44:15.303: W/FileTransfer(32613): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
12-14 22:44:15.303: W/FileTransfer(32613): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495)
12-14 22:44:15.303: W/FileTransfer(32613): at org.apache.cordova.FileTransfer$1.run(FileTransfer.java:484)
12-14 22:44:15.303: W/FileTransfer(32613): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-14 22:44:15.303: W/FileTransfer(32613): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-14 22:44:15.303: W/FileTransfer(32613): at java.lang.Thread.run(Thread.java:856)
12-14 22:44:15.311: E/FileTransfer(32613): {"target":"http:\/\/some_IP\/api_upload.php","source":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.tisamobile\/cache\/resize.jpg?1387057455160","http_status":0,"code":3}
12-14 22:44:15.311: E/FileTransfer(32613): java.io.EOFException
12-14 22:44:15.311: E/FileTransfer(32613): at libcore.io.Streams.readAsciiLine(Streams.java:203)
12-14 22:44:15.311: E/FileTransfer(32613): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
12-14 22:44:15.311: E/FileTransfer(32613): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
12-14 22:44:15.311: E/FileTransfer(32613): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
12-14 22:44:15.311: E/FileTransfer(32613): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495)
12-14 22:44:15.311: E/FileTransfer(32613): at org.apache.cordova.FileTransfer$1.run(FileTransfer.java:484)
12-14 22:44:15.311: E/FileTransfer(32613): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-14 22:44:15.311: E/FileTransfer(32613): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-14 22:44:15.311: E/FileTransfer(32613): at java.lang.Thread.run(Thread.java:856)
12-14 22:44:15.311: E/FileTransfer(32613): Failed after uploading 103425 of 103425 bytes.
것은 무엇 잘못 될 수 : 여기
이클립스 로그입니까? 어떤 제안도 감사합니다.
이 부분은 다음 주소에서 해결됩니다. http://stackoverflow.com/questions/17851259/phonegap-image-upload-works-only-once 9 월 7 일 5:07에 rand_mem_RAM 님이 작성했습니다. –