Powerpoint upload stops at ~9MB with cURL -F

孤者浪人 提交于 2019-12-20 06:19:36

问题


I have a problem using ConvertApi.com PowerPoint2Pdf conversion, when uploading files that are larger than 9MB. I can upload at least 43MB PowerPoint files through the browser form without problems, so it should not be a restriction in the API.

If the size is less than this, the conversion works with curl perfectly fine, when I use this line (Applying these instructions, with the appropriate changes):

curl -v -F file=@"filename.pptx" http://do.convertapi.com/PowerPoint2Pdf?apikey=YourApiKeyHere > output.pdf

Edit: That command actually works, but it was broken when combined with the URL found here

However, if I do the same with a file larger than 9MB, the curl progress meter shows that the currently uploaded amount of bytes stops growing after less than 10 seconds, with the Xferd field indicating that it has uploaded something around 9000k (in the example below, it is 9120k). Eventually the connection seems to stop every time after 2min 17s (once 2:16, tested 3 times with different >25Mb files), with the following output, or similar:

21 41.5M 0 0 21 9120k 0 67800 0:10:42 0:02:17 0:08:25 0 * Closing connection 0 curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

The error code 56 means apparently "connection reset by peer", but this happens more than two minutes after the upload has halted, so it seems to be a healthy reaction to the problem from the server side not to wait indefinitely for the upload to continue.

As the similar upload works consistently without problems when using the browser form, it should not be a problem with the browser configuration, but rather with my request.

As I am not very familiar with curl, and my searches didn't provide me any real insights in how to upload large binary files using -F, I am not sure how I should change the request.

I found a similar problem here, but there the problem seems to have been something depending on the server. PHP / CURL / ASP.NET / C# - Send files bigger than 9mb


回答1:


The problem seems to be caused by using the secure https:// form of the URL (which is found here), instead of the non secure http:// form (such as the one used here). So the form of the command as shown in the question actually works correctly:

    curl -v -F file=@"filename.pptx" http://do.convertapi.com/PowerPoint2Pdf?apikey=YourApiKeyHere > output.pdf


来源:https://stackoverflow.com/questions/36030675/powerpoint-upload-stops-at-9mb-with-curl-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!