camera.uploadFile
앱은 이 명령어를 카메라에 실행하여 이미지 업로드를 시작하거나
카메라에서 서버로 직접 전송하는 것입니다. 카메라는 포함된
매개변수를 사용하여 HTTP POST 요청을 형성합니다. 업로드할 파일은
fileUrl
파일을 올바른 값으로 uploadUrl
에
승인됩니다.accessToken
이 명령어는 API 수준에서
관련이 있으며
직접 업로드
컴퓨터 명령줄에서 다음과 같이 이를 수행할 수 있습니다.
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
매개변수
fileUrl:
: 서버에 업로드할 파일의 URL입니다.
uploadUrl:
파일을 업로드할 위치를 나타내는 문자열입니다.
accessToken:
다음을 위한 인증 정보가 포함된 토큰:
있습니다. 이는 앱에서 획득되어 카메라로 전송됩니다.
결과
오류
missingParameter:
일부 매개변수(예: fileUrl
)가 누락되었습니다.
invalidParameterName:
하나 이상의 입력 매개변수 이름이
인식할 수 없습니다.
invalidParameterValue:
입력 매개변수 이름이 인식됨
하나 이상의 전달된 값이 잘못되었습니다. 예를 들어
fileUrl
가 존재하지 않습니다.
uploadError:
카메라를 업로드할 수 없습니다.
명령어 I/O |
|
명령어 입력 |
{ "parameters": { "fileUrl": "URL of the file.", "uploadUrl": "A string representing where to upload the file.", "accessToken": "A token containing the authentication information." } } |
명령어 결과 |
none |
명령어 출력 (오류) |
{ "error": { "code": "uploadError", "message": "Camera failed to upload the file." } } |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-21(UTC)
[null,null,["최종 업데이트: 2024-08-21(UTC)"],[[["This command, available in API level 2.1 and later, allows apps to instruct the camera to directly upload images or videos to a server."],["The camera uses provided parameters (`fileUrl`, `uploadUrl`, `accessToken`) to form and send an HTTP POST request to the specified server."],["Direct Upload requires obtaining an access token and providing the file's URL and the server's upload URL within the command parameters."],["While the command itself returns no result, potential errors during the upload process can be indicated by specific error codes like `uploadError` or `invalidParameterValue`."]]],["The app directs the camera to upload a file to a server using an HTTP POST request. Key parameters include `fileUrl` (the file's location), `uploadUrl` (the destination), and `accessToken` (authorization token). The camera utilizes these parameters to perform the upload. No direct result is returned upon command execution, but error messages such as `missingParameter`, `invalidParameterValue` or `uploadError` will be returned if the command is not correctly executed. This feature was introduced in API level 2.1.\n"]]