<?php
// Receiving variables
@$userfile_Name = $_FILES['userfile']['name'];
@$userfile_Size = $_FILES['userfile']['size'];
@$userfile_Temp = $_FILES['userfile']['tmp_name'];
@$userfile_Mime_Type = $_FILES['userfile']['type'];
@$Name = addslashes($_POST['Name']);
@$E-mail = addslashes($_POST['E-mail']);
@$comment = addslashes($_POST['comment']);
function RecursiveMkdir($path)
{
if (!file_exists($path))
{
RecursiveMkdir(dirname($path));
mkdir($path, 0777);
}
}
if ($userfile_Size>0)
{
// Validation
if( $userfile_Size == 0)
{
header("Location: errorpage.html");
exit;
}
if( $userfile_Size >50000)
{
//delete file
unlink($userfile_Temp);
header("Location: errorpage.html");
exit;
}
$uploadFile = "upload/".$userfile_Name ;
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $userfile_Temp , $uploadFile);
chmod($uploadFile, 0644);
$userfile_URL = "http://www.lost-angelz.com/upload/".$userfile_Name ;
}
//Sending Email to form owner
$pfw_header = "From: $E-mail\n"
. "Reply-To: $E-mail\n";
$pfw_subject = "New File Upload";
$pfw_email_to = "
youremail@yourdomain.com";
$pfw_message = "There is a new file uploaded.\n"
. "-----------------------------------\n"
. "File Link: $userfile_URL\n"
. "Name: $Name\n"
. "E-mail: $E-mail\n"
. "Comment: $comment\n";
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: thankyoupage.html");
?>
Create a folder in your public_html directory, call it "upload" and give it permissions 777.
Copy the code, paste it in notepad, change
youremail@yourdomain.com with the real email in your Vodahost account. If you wish the file size limit different than the 50000 bytes i have put in the script, just change it. Go to Save as, choose File Type: All files, and save it as "upload.php" Upload it in your public_html folder.
Create two simple pages in BV, one called "errorpage" (for letting them know that the file is bigger than the allowed limit) and the second one "thankyoupage". Publish them. You are done.
Please note that in the email you will have the file link, so just click on it to openit in your browser. If the file name has blank spaces, then the link will be broken, and you will need to copy the whiole link and paste it in your browser's address bar. If the file is of a type that can't be opened in your browser, just use Blue FTP to download it from your site to your computer and then open it using the appropriate software.