Email form with file submission

Status
Not open for further replies.

darkpedro

New member
Nov 2, 2006
109
1
0
I'm looking for a web contact form that a user can also submit a file. For example, I'd like a user to submit a pic with name and info about the pic. The form should load that pic to a file hosting site, and send me the name, info and pic location.

Has anyone seen anything like this? If not, would it be hard (expensive) to develop?

Thanks
 


Very easy in PHP. It's just a form field to upload a file and then handle it with the script on the server side.
 
Ok. I recently did something similar, and should impart some knowledge on you since it's so hard to come by. I'm assuming you know PHP, and at least some cURL, fairly well.

1. Use cURL
2. Uploading files is done in the form of multipart/form-data. When you post to the form, instead of sending curl a string like param1=val1&param2=val2&param3=val3 in $fields, just give it an array. cURL will know what to do.
3. The file field should be prefixed with a @ following the realpath to the file. So like $field['file'] = "@/home/miles/public_html/your-site/@image.gif";
4. Whether you like it or not, the user needs to upload a file to your site for this to work. Then your site needs to upload it to "localhostr" or whatever. This is the equivalent bandwidth of one upload and one download, respectively.
 
  • Like
Reactions: darkpedro
Sweet. Thanks very much. I'll have to get my programmer off my other project for a little bit and see if he can whip this up.

+rep if I've got it.
Ok. I recently did something similar, and should impart some knowledge on you since it's so hard to come by. I'm assuming you know PHP, and at least some cURL, fairly well.

1. Use cURL
2. Uploading files is done in the form of multipart/form-data. When you post to the form, instead of sending curl a string like param1=val1&param2=val2&param3=val3 in $fields, just give it an array. cURL will know what to do.
3. The file field should be prefixed with a @ following the realpath to the file. So like $field['file'] = "@/home/miles/public_html/your-site/@image.gif";
4. Whether you like it or not, the user needs to upload a file to your site for this to work. Then your site needs to upload it to "localhostr" or whatever. This is the equivalent bandwidth of one upload and one download, respectively.
 
Status
Not open for further replies.