cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

,please explain upload api in swift in detail

nilesh123
Explorer | Level 3

Please explain dropbox v2 uoload API in detail.

I did not understand it in v1 is was explained neatly.

If i want to upload one audio file using dropbox v2 upload api then what should be value in path and input paramter ?

input should be what ? file or filename or filedata or fileurl ?

 

2 Accepted Solutions

Accepted Solutions

Re: ,please explain upload api in swift in detail

Dropboxer
Dropboxer

You can find the full documentation for all of the upload methods in the SwiftyDropbox SDK here:

 

https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/FilesRoutes.html#/s:FC13SwiftyDropbo...

 

If you click on a method name, it will expand to show the documentation for that method, including the full method definition with parameter types and descriptions, as well as the result type.

 

There's an example of making an upload call in the readme here:

 

https://github.com/dropbox/SwiftyDropbox#upload-style-request

 

So, for instance, in that example, to upload an audio file like you describe, you would supply the desired path for the uploaded file in the 'path' parameter, and supply the data for the file in the 'input' parameter. 

 

That example shows supplying the data as a Data object, but you can also supply a URL object or an InputStream object.

View solution in original post

Re: ,please explain upload api in swift in detail

Dropboxer
Dropboxer
The 'path' you supply should be the full desired path in Dropbox for the uploaded file, including the file name an extension, e.g., "/Some folder/myfile.mp3".

View solution in original post

6 Replies 6

Re: ,please explain upload api in swift in detail

Dropboxer
Dropboxer

You can find the full documentation for all of the upload methods in the SwiftyDropbox SDK here:

 

https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/FilesRoutes.html#/s:FC13SwiftyDropbo...

 

If you click on a method name, it will expand to show the documentation for that method, including the full method definition with parameter types and descriptions, as well as the result type.

 

There's an example of making an upload call in the readme here:

 

https://github.com/dropbox/SwiftyDropbox#upload-style-request

 

So, for instance, in that example, to upload an audio file like you describe, you would supply the desired path for the uploaded file in the 'path' parameter, and supply the data for the file in the 'input' parameter. 

 

That example shows supplying the data as a Data object, but you can also supply a URL object or an InputStream object.

View solution in original post

Re: ,please explain upload api in swift in detail

nilesh123
Explorer | Level 3
Thanks for the information.

when i write say "temp" as path and pass data at input it gets upload succesfully but my question now is that it doesn't recognize that its an audio file the what will be solution ? how should i do it ?

Re: ,please explain upload api in swift in detail

Dropboxer
Dropboxer
The 'path' you supply should be the full desired path in Dropbox for the uploaded file, including the file name an extension, e.g., "/Some folder/myfile.mp3".

View solution in original post

Re: ,please explain upload api in swift in detail

nilesh123
Explorer | Level 3
Thank you so much!!!!!!!!!! Greg

Re: ,please explain upload api in swift in detail

jdwileymon
Explorer | Level 3

I'm getting this same "an audio error occurred" when uploading .wav files, but with the javascript sdk. I can't seem to find any documentation or examples on how this data is supposed to be passed (in what format) to the function.

 

I'm using filesUpload as per:

 

var dbx = new Dropbox({ accessToken: 'token' });

dbx.filesUpload({path: filePath, contents: req.body.file, mode: 'overwrite'})
.then(function(response) {
res.sendStatus(200);
console.log("audio saved!");
})
.catch(function(error) {
console.error(error);
response.sendStatus(400);
});

 

  1. I've tried ArrayBuffer
  2. UInt8Array
  3. window.createObjectUrl(blob)
  4. blob data
  5. Binary data
  6. File object

The examples just show a "file" from a file input and passing that directly to the contents: param, but that doesn't work either. 

How is the data supposed to be passed for the contents param in filesUpload?

Re: ,please explain upload api in swift in detail

Dropboxer
Dropboxer

@jdwileymon I don't believe this thread is relevant to the problem you're seeing. This thread was about using the Swift SDK, but you're using the JavaScript SDK, and it also doesn't mention the "an audio error occurred" error you cited.

 

I'll follow up on your thread for this issue:

 

https://www.dropboxforum.com/t5/API-Support-Feedback/Audio-files-uploaded-give-quot-audio-error-has-...

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?