FIXED

I was getting an error value of 2.

This is the PHP upload script that I am using. Users are allowed to upload files with no restrictions. However, some .exe files fail to get uploaded while others work fine. I'm not sure what the problem is? (This script was taken from a PHP tutorial)

<?php
// Where the file is going to be placed 
$target_path = "uploads/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 



$target_path = "uploads/upload.exe";


if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
    echo '<br/>';
    echo '<br/>';
    echo '<a href="http://localhost/Test/uploads/run.php">Continue</a>';

} else{
    echo "There was an error uploading the file, please try again!";
}

?>
share|improve this question
1  
Any errors you receive? – Donny van V Jan 5 '14 at 22:22
    
". Users are allowed to upload files with no restrictions" dangerous – user557846 Jan 5 '14 at 22:22
    
$target_path = "uploads/upload.exe"; Whaaat? – FreshPro Jan 5 '14 at 22:23
    
@Dagon I know the risks, with having no restrictions. This is just for learning purposes. – Quaxton Hale Jan 5 '14 at 22:23
    
@FreshPro File gets renamed to upload.exe. I was testing something. – Quaxton Hale Jan 5 '14 at 22:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.