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

[Bedstraw] *smilax*
 
  [Back to weblog: Smilax.org]  
[Mega-Changes]
[Mega-Calendar]

Uploading with CURL

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


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

curl -F filestuff=@/tmp/mypicture.jpg https://username:passwd@wiki.yak.net/69.upload
You should be able to do this in a loop:
for x in *.jpg
do
   curl -F filestuff=@$x https://username:passwd@wiki.yak.net/69.upload
done

Download CURL for many platforms here -> http://curl.haxx.se/download.html

Discussion:

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

2003-11-05

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 ( http://www.artkast.com/ )

2003-12-17

by virgil:
[virgil@dhcp-144-68 Mini-Kryptos-Medusa]$ ./put.sh 32
curl: (51) SSL: unable to obtain common name from peer certificate
[virgil@dhcp-144-68 Mini-Kryptos-Medusa]$ cat put.sh
#!/bin/sh
for x in *.jpg
do
   curl -F filestuff=@$x https://****:****@kryptos.yak.net/$1.upload
done
[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 "smilax.org"

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

2005-01-29

by strick:
http://curl.haxx.se/download.html <-- CURL Downloads for many platforms

2008-10-09

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://***:*****@centrisian.com/1.upload done

2009-02-02

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:********@wiki.yak.net/928.upload ; done

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

2009-03-18

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

This uploads images to 1.attach

Any ideas?

Post a new message:

   

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