camera.uploadFile
Stay organized with collections
Save and categorize content based on your preferences.
The app issues this command to the camera to initiate upload of an image or
video directly from the camera to a server. The camera should use the included
parameters to form an HTTP POST request. The file to be uploaded is specified by
fileUrl
and it should be uploaded to uploadUrl
with the correct
authorization specified by accessToken
. This command was added in API level
2.1 and is relevant to
Direct Upload
One could do this from a computer command line as:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
Parameters
fileUrl:
The URL of the file to be uploaded to the server.
uploadUrl:
A string representing where to upload the file.
accessToken:
A token including the authentication information for the
upload. It is obtained by the app and sent to the camera.
Results
- This command returns no result.
Errors
missingParameter:
Some parameter, for example, fileUrl
is missing.
invalidParameterName:
One or more input parameter names are
unrecognized.
invalidParameterValue:
Input parameter names are recognized
but one or more passed value are invalid. For example, the file specified by
the fileUrl
does not exist.
uploadError:
Camera failed to upload.
Command I/O |
|
Command Input |
{ "parameters": { "fileUrl": "URL of the file.", "uploadUrl": "A string representing where to upload the file.", "accessToken": "A token containing the authentication information." } } |
Command Output |
none |
Command Output (Error) |
{ "error": { "code": "uploadError", "message": "Camera failed to upload the file." } } |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 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`."]]],[]]