cURL / Mailing Lists / curl-users / Single Mail

curl-users

Help with curl & forms

From: Brad Demers <bjdemers76_at_yahoo.ca>
Date: Tue, 17 Feb 2009 06:15:53 -0800 (PST)

Hello everyone,

I'm running into a bit of a problem with a workflow I'm trying to complete at work.

I'm reading some data from an InDesign document and then passing that information into a form in Safari via Applescript. That part works fine.

The
form creates another form in Safari with a file upload button; I can't seem to
figure out how to successfully manipulate that through Applescript, and I did some
research and I think that doing this through Safari/Applescript is not possible, so
I looked into the possibility of uploading the file via HTTP by using
Curl. I figured out that I'd need to log on first and get cookies set
up, so that part is done.

I'm trying to pass the following command to upload the file "test1.jpg"

curl -b cookies.txt -F "filefield=@/test1.jpg" -F "aiimage2=cj216200993826PM.jpg" http://holiday.____.com/admin/photoupdate_upload.asp

The
form's file identifier is "filefield", and "aiimage" is an identifier
for the filename that will be used after the image has been uploaded
(their server renames files to avoid duplications and so forth)

However, when I execute this command with the verbose mode on, this is what gets returned:

* About to connect() to holiday._____.com port 80 (#0)
* Trying 216.***.**.**... connected
* Connected to holiday._______.com (216.***.**.**) port 80 (#0)
> POST /admin/photoupdate_upload.asp HTTP/1.1
> User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
> Host: holiday._____.com
> Accept: */*
> Cookie: ASPSESSIONIDQQQRRQSA=NIPEJFMDHOFHMOALLFKCHJFG
> Content-Length: 67174
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------113569baa18b
>
< HTTP/1.1 100 Continue
< Server: Microsoft-IIS/5.0
< Date: Tue, 17 Feb 2009 03:16:16 GMT
< HTTP/1.1 500 Internal Server Error
< Server: Microsoft-IIS/5.0
< Date: Tue, 17 Feb 2009 03:16:17 GMT
< Content-Length: 351
< Content-Type: text/html
< Cache-control: private
<
Microsoft OLE DB Provider for ODBC Drivers
error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '='.

I'm
not sure what the problem is since everything else seems to be working
swimmingly. This is the only thing that's holding up my applescript
from working! Any ideas/suggestions would be very very welcome.

I'd just like to add though that cURL has been absolutely wonderful for me at work... I use it to automate an awful lot of our FTP processes at night and it's a real time saver!

      __________________________________________________________________
Get a sneak peak at messages with a handy reading pane with All new Yahoo! Mail: http://ca.promos.yahoo.com/newmail/overview2/

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-02-17