smilax:: WebLog #1 Topic : 2003-11-04 01.47.30 strick : Uploading with CURL [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   

[Bedstraw] *smilax*
  [Back to weblog:]  

Uploading with CURL

How to upload pictures & other files from a unix shell script

Substitute the filename (/tmp/mypicture.jpg), username, passwd, hostname, and the page number (69) with your data. Notice that the filestuff=@ must be used.

curl -F filestuff=@/tmp/mypicture.jpg
You should be able to do this in a loop:
for x in *.jpg
   curl -F filestuff=@$x

Download CURL for many platforms here ->


showing all 11 messages     [Show 3 7 *10* 14 30 100 999 days or 10 *20* 30 50 100 999 messages]


by strick:
oh 'curl' seems to be pretty standard on RedHat distro, also it's not hard to make yourself.

by strick:
artkast sez it's on his mac OSX ( )


by virgil:
[virgil@dhcp-144-68 Mini-Kryptos-Medusa]$ ./ 32
curl: (51) SSL: unable to obtain common name from peer certificate
[virgil@dhcp-144-68 Mini-Kryptos-Medusa]$ cat
for x in *.jpg
   curl -F filestuff=@$x https://****:****$1.upload
[virgil@dhcp-144-68 Mini-Kryptos-Medusa]$

-- note the user and password are correct.

by strick:
"unable to obtain common name from peer certificate"

i tried making new SSL certificate -- looks like it failed.

i'll try again, thx

by strick:
fixed. a cert without a "common name" is weird. now the CN is ""

curl likes it for me. hopefull for you too.

by strick:
how to make certs for SSL smilax:

    1  mkdir /tmp/sslkey
    2  cd /tmp/sslkey
    3  openssl req -new -text -nodes -out req -keyout key
    4  cat req
    5  openssl req -x509 -text -days 8888 -in req -key key -out cert
    6  less cert
    7  cat key cert > /data/key.pem
    8  cat cert > /data/root.pem
    9  chmod 400 /data/key.pem
   10  chown smilax.smilax /data/key.pem


by strick: <-- CURL Downloads for many platforms


by rtw:
I keep getting errors. What am I doing wrong?

curl (26) failed creating formpost data

for x in *.jpg do curl -F filestuff=@$x http://***:***** done


by strick:
semicolons before "do" and before "done".

Otherwise; I don't know -- here's the exact line I used this morning

for x in * ; do  curl -F filestuff=@$x http://strick:******** ; done

by strick:
Fetching CURL on Ubuntu and probably any Debian:
sudo apt-get install curl


by rtw:
for x in *.jpg; do curl -F filestuff=@$x http://***:******** ; done

This uploads images to 1.attach

Any ideas?

Post a new message:


(last modified 2005-01-29)       [Login]
(No back references.)