We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
julio_diniz_perdigao
10 months agoExplorer | Level 3
Upload to a specific file id
Hi!
Google Drive has an method that we can create the file ID first, before start upload.
Does Dropbox has somenthing similar?
My point is, to get file metadata, specially file size, after upload is done via getTemporaryUploadLink.
Knowing the file ID before, I can prevent broken response between the client-side upload and my back-end call.
Now, I am doing:
1 - create upload link with getTemporaryUploadLink (back-end)
2 - upload the file from client-side with the link passed by back-end
3 - when upload is done, send to the back-end the file ID
But I am affraid in step 3, some connections problem and not be able to pass the file ID to my back-end.
Thanks!
- ЗдравкоLegendary | Level 20
julio_diniz_perdigao wrote:...
But I am affraid in step 3, some connections problem and not be able to pass the file ID to my back-end.
...
You don't need to pass the id in step 3. Tracing the changes in target directory would give you exact moment of file upload and its id as soon as upload finishes without additional communication between client and server side. 😉
Hope this helps.
- julio_diniz_perdigaoExplorer | Level 3
Hi Здравко,
yes, but this will take time if target directory has many files. Anyway, a discovered that is possible to get file metada passing the full path instead of the file ID.
- Greg-DBDropbox Staff
julio_diniz_perdigao As Здравко suggested, you don't necessarily need the file ID and can instead monitor for changes. Check out the Detecting Changes Guide for information on how to do so.
If that isn't sufficient for your use case though, you could first upload a placeholder (e.g., a zero byte file, or something else of your choosing) from the back-end to get the file ID for that, and then configure the temporary upload link to overwrite that placeholder file.
- julio_diniz_perdigaoExplorer | Level 3
Hi Greg-DB !
Good tip! Do you know which process is more faster? I mean, get file metada from a file ID or file path? My guess is the file ID, when have a lot of files.
- Greg-DBDropbox Staff
julio_diniz_perdigao There's no particular guarantee on whether using a file ID or a file path to retrieve a file's metadata would be faster. (There may also be other variables that would affect that anyway.)
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 5 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!