Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
HrcKuhar
5 years agoNew member | Level 2
Upload file using jquery
I'm trying to upload an image to dropbox using jquery, but I get an error for cors policy block. Is there another way to upload?
My code:
var xhr = new XMLHttpRequest();
xhr.upload.onpr...
HrcKuhar
5 years agoNew member | Level 2
I'm using this code to upload file but I get an error:
"Value should match pattern '\\A(?:(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)|(id:.*))\\z' (Parameter 'path')"
var client = new DropboxClient("<access_token>, "<access key>", "<secret key>");
try
{
await Upload(client, "https://www.dropbox.com/sh/...dl=0/", <image filename>, "AvatarImage"); -- this url is a link to share folder
}
catch (Exception ex)
{
var error = ex.Message + ex.Source;
}
async Task Upload(DropboxClient dbx, string folder, string file, string content)
{
using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))
{
await dbx.Files.UploadAsync(
folder + "/" + file,
WriteMode.Overwrite.Instance,
body: mem);
}
}
Greg-DB
Dropbox Community Moderator
5 years agoIn this code, you are also attempting to upload to a shared link. Shared links do not support uploads like this. This method expects the path where you want to upload the file in the connected account. The error message is indicating that the path you're supplying is not in the expected format (since it is a shared link, not a path).
I recommend reading the File Access Guide for information on how to interact with paths and files in the Dropbox API.
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!