ponies3387 Posted February 6, 2008 Share Posted February 6, 2008 I created a simple form in dreamweaver with an email text field, file upload, 3 checkboxes, and a submit button. This script is supposed to send me their email address, checkbox results, and a link to the picture they uploaded onto my server in a folder called uploads. As of right now the script is sending me an email with no checkbox results, and the link takes me to the uploads folder to view the image but its not found. Heres the script, hopefully someone can help me. Oh and did I mention, this is my first script ever. I used a tutorial to make it ??? <?php @$email = addslashes($_POST['email']); @$upload_Name = $_FILES['upload']['name']; @$upload_Size = $_FILES['upload']['size']; @$upload_Temp = $_FILES['upload']['tmp_name']; @$upload_Mime_Type = $_FILES['upload']['type']; @$check1 = $_REQUEST['1'] ; @$check2 = $_REQUEST['2'] ; @$check3 = $_REQUEST['3'] ; function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { die("<p align='center'><b><font face='Arial Black' size='5' color='#FF0000'>Please enter a valid email</font></b></p>"); } if( $upload_Size == 0) { die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } // CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS if( $upload_Size >2000000) //-------- { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" ) { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } $uploadFile = "uploads/".$upload_Name ; if (!is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); } else { @chmod(dirname($uploadFile), 0777); } @move_uploaded_file( $upload_Temp , $uploadFile); chmod($uploadFile, 0644); //CHANGE THIS TO THE YOUR DOMAIN $upload_URL = "http://changedforprivacy/uploads/".$upload_Name ; //------------ $pfw_header = "From: $email"; $pfw_subject = "NEW SENT PHOTO"; // CHANGE THIS TO YOUR EMAIL ADDRESS $pfw_email_to = "info@changedforprivacy.COM"; //------------ $pfw_message = "email: $email\n" . "Name: $Name\n" . "upload: $upload_URL\n"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; echo("<p align='center'><b><font face='Arial Black' size='2' color='#0000FF'><br></font></b></p>"); include("SendSuccess.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/89755-errors-in-my-script/ Share on other sites More sharing options...
haku Posted February 6, 2008 Share Posted February 6, 2008 You need to use [code ] tags. Quote Link to comment https://forums.phpfreaks.com/topic/89755-errors-in-my-script/#findComment-459952 Share on other sites More sharing options...
kenrbnsn Posted February 6, 2008 Share Posted February 6, 2008 Please edit your question to put the tag before your code and the tag after. This will make your code much easier to read. Remove all '@' characters as using them suppresses errors. Ken Quote Link to comment https://forums.phpfreaks.com/topic/89755-errors-in-my-script/#findComment-459953 Share on other sites More sharing options...
ponies3387 Posted February 6, 2008 Author Share Posted February 6, 2008 ok, sorry I dont know how to to edit my original post, but I removed all the @s and still got an e-mail without the checkbox results, and a link that goes to "server not found" when its supposed to show the uploaded image. <?php $email = addslashes($_POST['email']); $upload_Name = $_FILES['upload']['name']; $upload_Size = $_FILES['upload']['size']; $upload_Temp = $_FILES['upload']['tmp_name']; $upload_Mime_Type = $_FILES['upload']['type']; $check1 = $_REQUEST['1'] ; $check2 = $_REQUEST['2'] ; $check3 = $_REQUEST['3'] ; function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { die("<p align='center'><b><font face='Arial Black' size='5' color='#FF0000'>Please enter a valid email</font></b></p>"); } if( $upload_Size == 0) { die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } // CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS if( $upload_Size >2000000) //-------- { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" ) { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } $uploadFile = "uploads/".$upload_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } else { chmod(dirname($uploadFile), 0777); } move_uploaded_file( $upload_Temp , $uploadFile); chmod($uploadFile, 0644); //CHANGE THIS TO THE YOUR DOMAIN $upload_URL = "http://private/uploads/".$upload_Name ; //------------ $pfw_header = "From: $email"; $pfw_subject = "NEW SENT PHOTO"; // CHANGE THIS TO YOUR EMAIL ADDRESS $pfw_email_to = "info@private.COM"; //------------ $pfw_message = "email: $email\n" . "Name: $Name\n" . "upload: $upload_URL\n"; mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; echo("<p align='center'><b><font face='Arial Black' size='2' color='#0000FF'><br></font></b></p>"); include("SendSuccess.html"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/89755-errors-in-my-script/#findComment-460012 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.