cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-524913 ] multipost form / file upload

From: <noreply_at_sourceforge.net>
Date: Sat, 02 Mar 2002 11:55:38 -0800

Bugs item #524913, was opened at 2002-03-02 11:55
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=524913&group_id=976

Category: http
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: multipost form / file upload

Initial Comment:
I found a bug that occurs in 7.9.2, 7.9.4, 7.9.5-pre4,
and 7.9.5-pre5.

Basically, I'm trying to do a multipart form post with
a jpeg image upload. However, every page that I upload
the file to says that its in a format they don't
recognize. If I upload the same image using Netscape,
it works fine.

All other fields come out ok.

Here's the relevant piece of my PHP code, am I doing
the file upload stuff correctly?

$ch = curl_init();
$image
= "/home/httpd/html/o/picture/images/2028672.jpg";
$post['FileData'] = "@$image";
curl_setopt
($ch,CURLOPT_URL,"http://www.picture.com/contest/upload
data.asp");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
$testPage = curl_exec ($ch);
curl_close ($ch);

I've also tested this on the curl command line:
curl -F FirstName=test -F MiddleName=t -F
LastName=test -F Address1=test -F Address2=test -F
City=test -F State=ca -F Zip=94025 -F Country=test -F
EMail=picturetest3_at_steve.mailshell.com -F Title=test -
F Category=1 -F AdKey=3511 -F SubAdKey=34338 -F
FileData=@/home/httpd/html/o/picture/images/2028672.jpg
 -v http://www.picture.com/contest/uploaddata.asp

uname output: Linux 2.2.19-6.2.1.2RS #1 Tue Jun 5
16:31:35 CDT 2001 i686 unknown

Thanks for your help! Let me know if you need more
info.

Steve

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=524913&group_id=976
Received on 2002-03-02