tandoorimix Posted April 30, 2008 Share Posted April 30, 2008 Hi. I'm using a php script called 'Dr Snaps 3D PHP Form-Mailer' which allows site visitors to email files to me. However, they can only send 1 file. I would like to add several more file upload fields to the form but am unsure how. The links to the scripts owners don't appear to be working anymore. You can download the original script from here... http://www.hair-heads.co.uk/3dFileFormMailerHTML4.zip I've tried just adding another file form field with the same name but I guessed it wouldn't work... and it didn't! I maybe wrong but I think this is the bit of script that needs to be edited to allow more than one file to be uploaded. Any help would be greatly appreciated. $form_fields=array_keys($HTTP_POST_VARS);$temp="Sender's IP Address: ".$_SERVER['REMOTE_ADDR']."\n";while($field = array_pop($form_fields)){$temp.="$field: $HTTP_POST_VARS[$field]\n";}$to=$_POST['To'];$from=$_POST['Email'];$message=$temp;$fileatt=$_FILES['File']['tmp_name'];$fileatt_type=$_FILES['File']['type'];$fileatt_name=$_FILES['File']['name'];$headers="From: $from";if(is_uploaded_file($fileatt)){$file=fopen($fileatt,'rb');$data=fread($file,filesize($fileatt));fclose($file);$semi_rand=md5(time());$mime_boundary="==Multipart_Boundary_x{$semi_rand}x";$headers.="\nMIME-Version: 1.0\n"."Content-Type: multipart/mixed;\n"." boundary=\"{$mime_boundary}\"";$message="This is a multi-part message in MIME format.\n\n"."--{$mime_boundary}\n"."Content-Type: text/plain;charset=\"UTF-8\"\n"."Content-Transfer-Encoding: 7bit\n\n".$message."\n\n";$data=chunk_split(base64_encode($data));$message.="--{$mime_boundary}\n"."Content-Type: {$fileatt_type};\n"." name=\"{$fileatt_name}\"\n"."Content-Transfer-Encoding: base64\n\n".$data."\n\n"."--{$mime_boundary}--\n";} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.