Camera.uploadFile
Uygulama, bir resmin yüklenmesini başlatmak veya
doğrudan kameradan bir sunucuya gönderilir. Kamera, ürünle birlikte verilen
parametrelerini kullanarak HTTP POST isteği oluşturun. Yüklenecek dosya
fileUrl
ve uploadUrl
hedefine doğru
yetkilendirme accessToken
tarafından belirtildi. Bu komut API düzeyinde eklendi
2.1 ve
Doğrudan Yükleme
Bu işlem bir bilgisayar komut satırından şu şekilde yapılabilir:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
Parametreler
fileUrl:
Sunucuya yüklenecek dosyanın URL'si.
uploadUrl:
Dosyanın nereye yükleneceğini temsil eden bir dize.
accessToken:
Verinin kimlik doğrulama bilgilerini içeren bir jeton
yükleyin. Veri, uygulama tarafından alınıp kameraya gönderilir.
Sonuçlar
- Bu komut sonuç döndürmez.
Hatalar
missingParameter:
Bazı parametreler (ör. fileUrl
) eksik.
invalidParameterName:
Bir veya daha fazla giriş parametresi adı
tanınmıyor.
invalidParameterValue:
Giriş parametresi adları tanındı
ancak iletilen bir veya daha fazla değer geçersiz. Örneğin,
fileUrl
mevcut değil.
uploadError:
Kamera yüklenemedi.
Komut G/Ç |
|
Komut Girişi |
{ "parameters": { "fileUrl": "URL of the file.", "uploadUrl": "A string representing where to upload the file.", "accessToken": "A token containing the authentication information." } } |
Komut Çıkışı |
none |
Komut Çıkışı (Hata) |
{ "error": { "code": "uploadError", "message": "Camera failed to upload the file." } } |
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-08-21 UTC.
[null,null,["Son güncelleme tarihi: 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"]]