कैमरा अपलोड करें
ऐप्लिकेशन किसी इमेज को अपलोड करने के लिए, कैमरे को यह निर्देश देता है या
वीडियो को सीधे कैमरे से सर्वर पर पहुंचाता है. कैमरे को
पैरामीटर का इस्तेमाल करके एचटीटीपी पीओएसटी अनुरोध करते हैं. अपलोड की जाने वाली फ़ाइल इसके ज़रिए तय की गई है
fileUrl
और इसे uploadUrl
पर सही के साथ अपलोड किया जाना चाहिए
accessToken
द्वारा निर्दिष्ट प्राधिकरण. यह निर्देश, एपीआई लेवल में जोड़ा गया था
2.1 और यह इन चीज़ों के लिए काम का है
सीधे तौर पर होने वाला अपलोड
कंप्यूटर कमांड लाइन से ऐसा किया जा सकता है:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
पैरामीटर
fileUrl:
सर्वर पर अपलोड की जाने वाली फ़ाइल का यूआरएल.
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 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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"]]