CURLSMBS

Does anyone have examples of uploading an image to a php script using CURLSMBS?

I need to upload a file, and a couple bits of information, like name and location, to store in a MySQL database.

I have a php script that receives the fields, or at least seems to. I am unsure of how to get CURLSMBS to upload a file. It uploads the textual fields just fine.

I would appreciate any sample projects that allow one to open an image, and upload it with a couple text fields to a web server.

Cheers.
Bobby

this example post form values:
http://www.monkeybreadsoftware.net/example-curl-curlspostformvalues-curlspostformvalues.shtml

and this includes a file field:
http://www.monkeybreadsoftware.net/example-curl-curlspostform-curlspostform.shtml

Combine them and you have your form uploader.

Hi Christian,

In your example, what is the field name that would be seen by the receiving php script?

d.FormAdd(CURLFORM_COPYNAME,"myfile",CURLFORM_BUFFER, file.Name, CURLFORM_BUFFERPTR, buf, CURLFORM_BUFFERLENGTH, lenb(buf))

I would have guessed it is “myfile”, but it doesn’t appear to be passed.

Cheers.

it is myfile as you see in cgi script:
my $file = $cgi->param(“myfile”);

That’s what I would have thought, thanks.

For whatever reason, php doesn’t see it passed as a variable name.

I now believe the issue may now be with the php script, as I have finally, with your assistance, gotten the program to send the file (or so it seems).

Cheers.