We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Esikhoob
8 months agoHelpful | Level 5
corrupted file will save on Dropbox`s Temporary link
Hi
In our website, there is an option to uploads files to a Dropbox account. I have used Dropbox`s Temporary link for this purpose. I have implemented a solution which create the Temporary link using C# Dropbox SDK , and then upload file using jQuery ajax post formdata.
The problem is that all video files (.mp4, .avi) get corrupted after this upload. Other files type get upload successfully.
After creating a Temporary link (for example: https://content.dropboxapi.com/apitul/1/eE8ccUfewDC6NQ) , I use this code to upload:
<form action="https://content.dropboxapi.com/apitul/1/eE8ccUfewDC6NQ" method="post" enctype="multipart/form-data">
<input name="fileDropbox" type="file" class="form-control input-lg" readonly="true" onclick="return false;">
</form>
The above form will pass to following function via funtion`s "fileForm" parameter
function uploadFileToDropbox(fileForm, el) {
const postData = new FormData(fileForm);
$.ajax({
url: $(fileForm).attr("action"), // Dropbox
type: 'post',
data: postData,
crossDomain: true,
dataType: 'json',
success: function (res) {
fileUploadRemain -= 1;
if (fileUploadRemain === 0) // آیا همه فایلها آپلود شدند
uploadLinkPreFile(el);
},
error: function (error) {
let errorMess;
if (error.error === undefined)
errorMess = error;
else if (error.error.error_summary === undefined) {
errorMess = error.responseText; // مثلا: خطای پر شدن حساب دراپباکس
}else {
errorMess = error.error.error_summary;
console.log(error.error);
}
sendErrors.append("<div class='alert alert-danger'>خطا در " + errorMess + " :Dropbox</div>");
el.modal("hide"); // خطا را خوب اون پشت نوشتی، باید اینو ببندم یا نه؟!؟
App.unblockUI(el);
App.scrollTo(sendErrors);
},
cache: false,
contentType: "application/octet-stream",
processData: false
});
}
The upload will finish with no error, but after downloading, the file is corrupted.
This is a sample of corrupted video file:
Trados_Learning.mp4 (dropbox.com)
please help me to resolve this problem.
Esikhoob wrote:...
The upload will finish with no error, but after downloading, the file is corrupted.
This is a sample of corrupted video file:
Trados_Learning.mp4 (dropbox.com)
please help me to resolve this problem.
Hi Esikhoob,
The file not only has finished without error but is definitely not corrupted! It's another story that you cannot play this file in regular way, because of some upload mistake you have (error that's not reported, cosa Dropbox server cannot know about it). Just as an example see a screenshot of your video posted (on second 3 out of 23:34):
🤔 Is that you or whoever you took a shot of? 😁
Dropbox API (and all links produced) gives and expect raw data, not something else! Something you have ignored!!! How you got your data (movie) passed? 🧐
Esikhoob wrote:...
<form action="https://content.dropboxapi.com/apitul/1/eE8ccUfewDC6NQ" method="post" enctype="multipart/form-data"> <input name="fileDropbox" type="file" class="form-control input-lg" readonly="true" onclick="return false;"> </form>
...
That's it. You still receive the same video, but "packed" in multipart form data. And since that's what you have forwarded, exactly the same you receive. Of course, most video players cannot distinguish packed video in such a way. Again, the keyword is raw data!!! Don't ignore it anymore and all will work. 😉
Hope this helps.
- ЗдравкоLegendary | Level 20
Esikhoob wrote:...
The upload will finish with no error, but after downloading, the file is corrupted.
This is a sample of corrupted video file:
Trados_Learning.mp4 (dropbox.com)
please help me to resolve this problem.
Hi Esikhoob,
The file not only has finished without error but is definitely not corrupted! It's another story that you cannot play this file in regular way, because of some upload mistake you have (error that's not reported, cosa Dropbox server cannot know about it). Just as an example see a screenshot of your video posted (on second 3 out of 23:34):
🤔 Is that you or whoever you took a shot of? 😁
Dropbox API (and all links produced) gives and expect raw data, not something else! Something you have ignored!!! How you got your data (movie) passed? 🧐
Esikhoob wrote:...
<form action="https://content.dropboxapi.com/apitul/1/eE8ccUfewDC6NQ" method="post" enctype="multipart/form-data"> <input name="fileDropbox" type="file" class="form-control input-lg" readonly="true" onclick="return false;"> </form>
...
That's it. You still receive the same video, but "packed" in multipart form data. And since that's what you have forwarded, exactly the same you receive. Of course, most video players cannot distinguish packed video in such a way. Again, the keyword is raw data!!! Don't ignore it anymore and all will work. 😉
Hope this helps.
- EsikhoobHelpful | Level 5
Yes That is me.
thankyou
- Greg-DBDropbox Staff
Esikhoob Здравко is correct; it looks like you're uploading the video as form data, but you need to send the original raw video data, not modified with any formatting or additional encoding. I confirmed that the file you shared starts with "------WebKitFormBoundaryaCK6EdHRBgQMkUuo..Content-Disposition: form-data;". You'll need to update your implement to upload the raw video data only.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,876 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!