מצלמה.uploadFile
האפליקציה מנפיקה את הפקודה הזו למצלמה כדי להתחיל העלאה של תמונה או
וידאו ישירות מהמצלמה לשרת. המצלמה צריכה להשתמש
כדי ליצור בקשת HTTP POST. הקובץ להעלאה מצוין על ידי
צריך להעלות את הקובץ fileUrl
אל uploadUrl
עם הערכים הנכונים
שצוינה על ידי accessToken
. הפקודה הזו נוספה ברמת ה-API
2.1 והוא רלוונטי
העלאה ישירה
תוכל לעשות זאת באמצעות שורת פקודה במחשב באופן הבא:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
פרמטרים
fileUrl:
כתובת ה-URL של הקובץ שיש להעלות לשרת.
uploadUrl:
מחרוזת שמייצגת את המיקום שבו צריך להעלות את הקובץ.
accessToken:
אסימון שכולל את פרטי האימות עבור
. הוא מתקבל על ידי האפליקציה ונשלח למצלמה.
תוצאות
- הפקודה הזו לא מחזירה תוצאה.
שגיאות
missingParameter:
חסר פרמטר מסוים, לדוגמה fileUrl
.
invalidParameterName:
שם אחד או יותר של פרמטר קלט
לא מזוהה.
- זוהו
invalidParameterValue:
שמות של פרמטרים של קלט
אבל אחד או יותר מהערכים שהועברו אינם חוקיים. לדוגמה, הקובץ שצוין
השדה fileUrl
לא קיים.
- העלאת המצלמה של
uploadError:
נכשלה.
Command 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. Java הוא סימן מסחרי רשום של חברת 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"]]