Hi guys,
I was hoping that someone could maybe help me with this script that I am trying to write ... I am trying to upload videos ... I took the code from php.net ... so I have no idea why its not working.
On the off chance that move_uploaded_file succeeds and the output states that the file was uploaded and then when I check the folder on the server ... there's nothing there. I have tried with files under 1mb and over 1mb ... nothing seems to work ... can anyone find my error?
This is my form ...
<FORM method='post' enctype='multipart/form-data' action='uploader.php' >
<input type='hidden' name='MAX_FILE_SIZE' value='5000000'>
File 1: <input type='file' name='uploadedfile' size='30'><br><br>
<input type='submit' value='Upload'>
</form>
This is my server side code ...
// NOTE: Should only allow video upload.
echo "entered testuploaded.php";
if( $_FILES['uploadedfile']['size'] == 0 && $_FILES['uploadedfile']['tmp_name'] == '' )
{
// no file uploaded.
echo "No File UPloaded!";
}
$uploaddir = $_SERVER['DOCUMENT_ROOT'] . "/videos/";
$uploadfile = $uploaddir . basename($_FILES['uploadedfile']['name']);
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
echo "uploadfile - " . $uploadfile;
print_r($_FILES);
} else {
echo "Possible file upload attack!\n";
echo $_FILES['uploadedfile']['error'];
print_r($_FILES);
}
Thanks