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 = "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

 

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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.