View Single Post
  #34  
Old 11-19-2006, 07:18 AM
clanffa clanffa is offline
First Lieutenant
 
Join Date: Nov 2006
Posts: 180
Send a message via AIM to clanffa
Default Re: How to upload a file using a form

Quote:
<?php

// Receiving variables

@$email = addslashes($_POST['email']);
@$upload_Name = $_FILES['upload']['name'];
@$upload_Size = $_FILES['upload']['size'];
@$upload_Temp = $_FILES['upload']['tmp_name'];


// Validation for max file size

if ($upload_Size>0)
{
if( $upload_Size >200000000)
{
//delete file
unlink($upload_Temp);
header("Location: error.html");
exit;
}
$uploadFile = "uploads/".$upload_Name ;

@move_uploaded_file( $upload_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload_URL = "http://www.ffaproam.com/uploads/".$upload_Name ;
}

//Sending Email to form owner

$mailto = "jackshinta@ffaproam.com";
$mailsubj = "Video Upload";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Video Upload Details :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
$mailbody .= "upload: $upload_URL\n";
mail($mailto, $mailsubj, $mailbody, $mailhead);

header("Location: thankyou_page.html");

?>
OK Here's that php script you have asked for!
Reply With Quote