Hi,
This is my first email form which submits attachments and its starting to get quite frustrating.
I am very new to PHP as well, so forgive any glaring mistakes.
I've got it to work on one web service running php 4.4.9. But of course I need it on a php 5.2.14.
I can only deduce that it must be the change to the versions. Everything is the same except that.
Under the same conditions on the php5 server with IE I get http 500 internal server error and under Firefox I get;
<!-- SHTML Wrapper - 500 Server Error -->
[an error occurred while processing this directive]
My form points to the php which is there.
Any help would be appreciated
Thanks
Here is the code
PHP Code:
<?
$Name =$_REQUEST['Name'];
$Email =$_REQUEST['Email'];
$Phone =$_REQUEST['Phone'];
$City =$_REQUEST['City'];
$Company =$_REQUEST['Company'];
$Quantity =$_REQUEST['Quantity'];
$description =$_REQUEST['description'];
$Memory =$_REQUEST['Memory'];
$MaxFileSize = "2048000"; // max file size in bytes
$HDDSpace = "1048576"; // max total size of all files in directory
$HDDTotal = "445";
$OffExt = "";
// add characters to strip out of filenames
$ThisFileName = basename(__FILE__); // get the file name
$abspath = str_replace($ThisFileName,"",__FILE__); // get the directory path
// full path
$path=$abspath;
$pathext="upload/";
$snr = array("%","'","+","\\","/","#","..","!",'"',',','?','*','~');
$temp=$HTTP_POST_FILES['uploadedfile']['name'];
if($HTTP_POST_FILES['uploadedfile']['name'])
{
$HTTP_POST_FILES['uploadedfile']['name'] = strip_tags($HTTP_POST_FILES['uploadedfile']['name']);
$HTTP_POST_FILES['uploadedfile']['name'] = str_replace($snr,"",$HTTP_POST_FILES['uploadedfile']['name']); // remove any % signs from the file name
$HTTP_POST_FILES['uploadedfile']['name'] = trim($HTTP_POST_FILES['uploadedfile']['name']);
/* if the file size is within allowed limits */
if($HTTP_POST_FILES['uploadedfile']['size'] > 0 && $HTTP_POST_FILES['uploadedfile']['size'] < $MaxFileSize)
{
/* if adding the file will not exceed the maximum allowed total */
if(($HDDTotal + $HTTP_POST_FILES['uploadedfile']['size']) < $HDDSpace)
{
/* put the file in the directory */
move_uploaded_file($HTTP_POST_FILES['uploadedfile']['tmp_name'], $path.$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$OffExt);
$msg = "The file ".$HTTP_POST_FILES['uploadedfile']['name']." is Successfully uploaded ";
$myfrom = $Email;
$myemail = "lhadley91@hotmail.com";
$todayis = date("l, F j, Y, g:i a") ;
$filename="http://usbframes.com/".$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$OffExt;
$filename=str_replace("","%20",$filename);
$email= stripcslashes($email);
$name= stripcslashes($name);
$phone= stripcslashes($phone);
$description= stripcslashes($description);
$City= stripcslashes($City);
$Company= stripcslashes($Company);
$Quantity= stripcslashes($Quantity);
$subject= "Request From Website";
$message = "
uploadedfile : $filename
Name : $Name
Email : $Email
Phone : $Phone
City : $City
Company : $Company
Quantity : $Quantity
Description : $description
Memory : $Memory
";
$from = "From: $myfrom\r\n";
mail($myemail, $subject, $message, $from);
}
else
{
$msg = "The Filename: ".$HTTP_POST_FILES['uploadedfile']['name']." is BLOCKED from being uploaded here.";
}
}
else
{
$MaxKB = $MaxFileSize/1024; // show the max file size in Kb
$msg = "The file was greater than the maximum allowed, file size of $MaxKB and could not be uploaded.";
}
}
header('Location:http://www.usbframes.com/thankyou.html');
?>