Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Amicao
4 years agoExplorer | Level 3
How to get a temporary link from file that was uploaded via Dropbox API
Hello, good afternoon for all, i am here again for other problem related to get temporary link from file.
I made a Laravel system using the Dropbox API to get a file from user, upload it and la...
- 4 years ago
Amicao wrote:... a file from user, upload it and later, get a access for this file and delete it if necessary. The problem is that upload the file and Dropbox change the file name to a own Dropbox hash system. ...
Hi Amicao,
It's good idea to you share some piece of your algorithm able to reproduce the issue. Generally Dropbox API doesn't change file name if there is no other file already existing with the same name on the same place (path). Even when such file exist it can be updated, depending on your intention, upload can fails, or automatically rename it (whatever appropriate).
Amicao wrote:... And it difficult me to get the temporary link automatically via Laravel, because my system don't know now my file name automatically. ...
On successful file upload (either with changed or intended name) actual name gets as a part of the API access point result (take a look on /2/files/upload Returns section, for example). So you (your system) definitely know how your file gets named and the file id too. Using this you can pass it to the 2/files/get_temporary_link call.
Amicao wrote:... Does exist a way to me disable the file name name alteration? ...
Take a look on "mode" parameter for possible alternatives.
Amicao
4 years agoExplorer | Level 3
Здравко I think you didn't understand. First I wanted to say that the Laravel Framework uses a structure called Filesystem, from which they create "drivers" disks that supposedly said by the community, would support Dropbox, with standardized methods of insertion, deletion etc, however, what I see is that in these methods, it treats the input that would supposedly be the concatenation of the file path with the file name, differentiating when making the request in the lower layer of the framework what the folder path will be and what the file name will be in the Dropbox, which doesn't happen, at least according to community reports, in saying that it used to work, now it doesn't.
So, that's why I'll work with Curl on the top layer of the Framework, giving up the framework's own drivers.
Another question of mine that I don't know if it was clear to you, is that the application must receive a file via POST request from the user, and on the server it must get this binary object from the file via $_FILE and then submit it somehow via Curl request for the Dropbox API.
And from what I saw in the Dropbox documentation, in the "upload" tab it asks for the file path as the body of the request, which would supposedly be the file on the user's machine, but the curl command would have to run on the user's machine too, and not the case here. In this case I will only have the file object and not its path, so how do I instead pass the file path to the command to search and get the binary object, I already pass the binary object?
Здравко
4 years agoLegendary | Level 20
Amicao, 🙂 Your questions are outside Dropbox API scope itself. As far as I can see you are confused by usage of your tools. CURL in PHP typically adds file content independent from headers and you can take a look on some tutorial for this. The command line version really by default catches files. Even in this case you can pass a special file - the standard input. Just as example, try following:
echo -n "Hello World" | curl -X POST https://content.dropboxapi.com/2/files/upload \
-H 'Authorization: Bearer <your access token here>' \
-H 'Content-Type: application/octet-stream' \
-H 'Dropbox-API-Arg: {"path":"/upload_test.txt"}' --data-bin @-What gets up? 😉
To the other things, you should know best what where is. Only you know what is/are field(s) name(s) in use on the site. Just do it!
By the way, If you don't know, you can prototype and test API code/algorithms here.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!