Hi, I'm trying to make an upload page. I found some sample code that kind of works, I can upload pictures, most of the time but everytime I try to upload anything other than a picture(.xls, .doc, etc) I get an error that says "Possible file upload attack!". Now I know that it says that because its coded in the php, but I can't seem to figure out why its not uploading. Is there maybe something I have to change in the php configuration? Here is my code;
Code:
<?php session_start(); if(!session_is_registered(myusername)){ header("location:index.php"); } $un = $_SESSION['username']; $uploaddir = "/opt/lampp/htdocs/scotts/user_folders/" . $un . ""; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?>
Comment