cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem sending large compressed file

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 11 May 2007 10:16:13 -0700

On Fri, May 11, 2007 at 12:44:05PM -0400, Woody Gingery wrote:
> We have a large file that our customer has requested we send compressed. The
> file is being sent from a Perl script that is using https and curl. If we send
> the file compressed, the customer is unable to uncompress it with Winzip. We
> compressed it using gzip on a Unix server. I suspect I need to specify
> something in the curl command to send a compressed file but am unclear as to
> the syntax and various options (new to curl). This works okay with the file
> uncompressed. Should I be using the "data-binary" option?

--data-binary produces a application/x-www-form-urlencoded form, whereas
-F produces a multipart form. You can't necessarily replace one with
the other.

> The command in the script is: (I have disguised user name, password, etc)
>
> "https:\/\/www.xxxx.xxxx.xx.xx\/WebFX\/MainMenu\/Uploads\/UploadAFile\/
> index.cfm?fuseaction=loginandinsertdocumentrecord";
> # setup the system call to curl, passing the appropriate flags
> # --fail suppress output so it dies nicely
> # --output says to direct the output to the file named in $ARGV[3]
> # $http_string is where the file name and https address are stored
> @args = ("curl", '--fail', '-F', 'username=xxxxxxx', '-F',
> 'password=xxxxx', '-F', 'documentname='.$document_name, '-F',
> 'expirationdate='.$expire_date, '-F', 'Filecontents=@'.$source_file, '-F',
> "pbADD='Add new document information'", $https);

You aren't setting a Content-Type on the uploaded file. curl might be
guessing and sending a type that's not binary. Use the ;type= syntax
to set an appropriate MIME type (e.g. application/octet-stream). It's
possible that the upload script expects something else (like a
Content-Encoding header). Are you able to correctly upload a compressed
file to this site using a browser?

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-05-11