Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
MartaMarco1972
9 years agoExplorer | Level 3
using c# for upload text file
I'm trying to upload a text file to my account, but something I'ts wrong
static async Task Run() { using (var dbx = new DropboxClient("MYTOKEN")) { var file = "list.txt"; var folder = "/Users/user01/Downloads/"; var lastpath = folder + file; var mem = new MemoryStream(File.ReadAllBytes(@"C:\Users\user01\Downloads\list.txt")); var upload = await dbx.Files.UploadAsync(lastpath, Dropbox.Api.Files.WriteMode.Overwrite.Instance, false, null, false, mem); Console.WriteLine(upload); Console.ReadLine(); } }
- There's an example here that defines a task that takes a parameter:
https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L239
And then calls it here:
https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L94
14 Replies
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
What error message do you get when you run your code?
- MartaMarco19729 years agoExplorer | Level 3I don't receive any message, but the file is not uploaded..
- Greg-DB9 years ago
Dropbox Community Moderator
If there isn't an exception being raise with some error, the method should be returning. You're saving the output to `upload`. Can you share the output from `Console.WriteLine(upload);` in that case? - MartaMarco19729 years agoExplorer | Level 3The only text displayed is
Dropbox.Api.FileMetaData - Greg-DB9 years ago
Dropbox Community Moderator
That's the FileMetadata returned by UploadAsync indicating that the call succeeded. You can access properties of that FileMetadata to see specific information about the uploaded file, e.g., PathDisplay.
Where are you looking such that it seems the file wasn't uploaded? If your app uses the "app folder" permission, make sure you're looking inside the app folder for the app, by default at "/Apps/<app folder name>". That "/Apps" will be localized depending on the locale set for the account though, e.g., "/Applicazioni" for Italian, etc.
- marcomarta19729 years agoExplorer | Level 3Ok i Will check the path
If i want to upload on a specific dropbox folder how can I do? - Greg-DB9 years ago
Dropbox Community Moderator
You specify where in the Dropbox account you want to upload the file via the 'path' parameter that you give to UploadAsync. (That's the first parameter to UploadAsync in the code that you shared earlier.)
Note that for apps with the 'app folder' permission, the app can only upload within its app folder. The path you supply with be used relative to the app folder. If you want to be able to upload anywhere in the Dropbox account, you need to use the 'full Dropbox' permission instead. You can find more information about the different permissions here.
- marcomarta19729 years agoExplorer | Level 3Ok I understand, the update of the app folder is immediate?
- Greg-DB9 years ago
Dropbox Community Moderator
Yes, when uploading via the API, the file will be available in the app folder as soon as the upload API call returns. - MartaMarco19729 years agoExplorer | Level 3
All works fine now!
The file was on application directory,
Now I've change the kind of API to access all my files
Thanks!
Thanks!!
Thanks!!!
About Dropbox API Support & Feedback
Find help with the Dropbox API from 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!