Jump to content

File Uploading Problem


bigkga

Recommended Posts

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

 

<?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 = "[email protected]";

$subject = "A File has been uploaded by " . $var2;

$body = "";

$headers = 'From: [email protected]';

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

 

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.

Link to comment
https://forums.phpfreaks.com/topic/92244-file-uploading-problem/
Share on other sites

Hi there

 

Thanks for that answer. I now get this error message which is progress i think

 

../Uploads/bob/tv.jpg

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxxxx/www/Scripts/uploader.php:13) in /home/xxxxxxxx/www/Scripts/uploader.php on line 24

 

 

Line 24 is

 

header("Location: https://sexxxxxx.xxxxxxxx.net.nz/xxxxxxxnetnz/fileuploaded.php");

 

 

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.