PHP - Is_uploaded_file()
I'm using this to upload files to the server... sometimes files doesn't get uploaded.
Code: [Select] <?php if (is_uploaded_file($_FILES['Filedata']['tmp_name'])){ $uploadDirectory="uploads/"; $uploadFile=$uploadDirectory.basename($_FILES['Filedata']['name']); copy($_FILES['Filedata']['tmp_name'], $uploadFile); } ?> Similar Tutorialsi have a this script move_uploaded_file($_FILES['ufile']['tmp_name'][1],$path1); if(is_uploaded_file($_FILES['ufile']['tmp_name'][1])){ echo "Upload successful";} i get file that has been uploaded inside upload folder but i dont know why the echo "Upload successful" didnt appear thanks Hi guys Sorry i keep asking noob questions today... I'm working on something that has a user facing image upload facility. So i'm slowly working through a class to make this as secure as possible. One of the tips online is to use the method "is_uploaded_file ( )". According to php.net - "Returns TRUE if the file named by filename was uploaded via HTTP POST. This is useful to help ensure that a malicious user hasn't tried to trick the script into working on files upon which it should not be working--for instance, /etc/passwd. " I'm not one to just use things without understanding why. So how exactly could someone get a script to work on an internal file via a browse/upload facility? |