Page 1 of 1

File Uploading Problem

Posted: Thu Feb 21, 2008 9:56 pm
by bigkga
I am having trouble with my file uploader on a webpage. Whenever I test it out I get the message that there is an error. I have separate uploads directory for the "client" so that person can upload.

My uploader.php contains the following

***** PLEASE USE THE CODE TAG WHEN POSTING *****

Code: Select all

<?php
require '/home/xxxxxxxxx/Includes/connect.php';
 
/* Assign variables from form */
$var1 = mysql_real_escape_string($_POST["leadon"]);
$var2 = mysql_real_escape_string($_POST["client"]);
 
 
$target_path = $var1 . $var2 . '/';                     /*Create path to upload to*/
 
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
echo $target_path;
 
if(move_uploaded_file($_FILES['uploadedfile']['name'], $target_path)) { /*If file successfully moved to directory*/
   /* Send Email to us */
   $to = "info@xxxxxxxxxxxx.net.nz";
   $subject = "A File has been uploaded by " . $var2;
   $body = "";
   $headers = 'From: info@xxxxxxxxxx.net.nz';
   mail($to, $subject, $body, $headers);
   
   /* Once complete return to........ */
   header("Location: https://xxxxxxxxxxxxxxxxxxxxxxxx/fileuploaded.php");
}else{
    echo "There was an error uploading the file, please try again!";
}
?>
 
My .htaccess file contains the following

Code: Select all

redirect /Clients/bob http://www.xxxxxxxxxxxxx.net.nz
redirect /Clients/bob/ http://www.xxxxxxxxxx.net.nz
RedirectMatch (.*)\index.php http://www.xxxxxxxxxx.net.nz
<Files ~ "\.(in|sql|pdf)$">
order allow,deny
deny from all
</Files>


bob is the client name.

What is wrong with this? I think it use to work but not anymore.