Forum Moderators: coopster

Message Too Old, No Replies

my form script- whats wrong?

help please

         

ReyGonza

8:15 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



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 because I see nothing wrong.
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://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");
?>

eelixduppy

8:19 pm on Feb 6, 2008 (gmt 0)



Hello and Welcome to WebmasterWorld!

Are you getting any errors from this script. Try turning up your error_reporting:


[url=http://www.php.net/error-reporting]error_reporting[/url](E_ALL);

ReyGonza

10:27 pm on Feb 6, 2008 (gmt 0)

10+ Year Member



Hi thanks for the welcome! Im sorry but I do not understand your error report reply... Im really really new to all this and ive been trying to get help with my script for weeks!

Theres no error messages, it just doesnt work properly like I explained.

im puzzled.