curl-users
Re: curl: Argument list too long
Date: Fri, 4 Dec 2009 10:17:26 -0700
At 16:22 +0000 12/4/09, Harry wrote:
>>--- On Thu, 12/3/09, Harry <lolwutaf2_at_gmail.com> wrote:
>
>>> From: Harry <lolwutaf2_at_gmail.com>
>>> Subject: curl: Argument list too long
>>> To: curl-users_at_cool.haxx.se
>>>> Date: Thursday, December 3, 2009, 9:23 PM
>>> Hi, I am trying to get cURL to upload
>>> an image scrotted onto a PHP file uploader.
>>>
>>> Here is my code so far, if you can help me, I'd be glad.
>>>
>>>
>>>
>>> #!/bin/bash
>>> scrot screenshot.png
>>> curl -v -A "scrotty-v1" "http://harryy.us/upload/index.php" --max-time '60'
>>> --max-filesize '5000000' -F "mailfile=`cat screenshot.png`"
>>>
>>> At the moment, I get "curl: Argument list too long".
>>>
>>>
>>> Thank you in advance.
>>> -------------------------------------------------------------------
>>The
>>
>>"mailfile=`cat screenshot.png`"
>>
>>part looks strange to me. This is because
>>
>>cat screenshot.png
>>
>>is executed, and then its stdout is placed into the double quoted string, the whole
>>
>>"mailfile=`cat screenshot.png`"
>>
>>is 'mailfile=' plus contents of 'screenshot.png' file, And I think this is
>>what makes your command too line long.
>>
>>OTOH, you command line doesn't make sense to because of the above in the first place.
>>
>>Did you mean regular single quotes ("'") and not the backquotes ("`") ?
>>
>>Thanks,
>> Sergei.
>
>Hi, the script is used for uploading an image to a PHP file uploader.
>It's intentional to make the contents of the screenshot file uploaded, or I would think so.
>
>Unless you suggest a better way to upload the screenshot.png onto the server, via that PHP upload form?
How about the @ syntax after the -F option to ask curl to find the content of a named file? curl is willing to perform the cat operation for you.
Putting the entire content of an image in the command line is sure to exceed someone's idea of a reasonable length limit.
I don't think -F supports a filename that is just a dash (-) which would tell curl to read from standard input but I'll bet there is a way to use your cat operation with a subsequent pipe into curl's standard input. I know it can work with an ftp server instead of an http POST into apache.
-- --> From the U S of A, the only socialist country that refuses to admit it. <-- ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2009-12-04