0

i'm trying to upload a song with an html form and a php code. I've found on the net loads of scripts but noone seems to do the work. I mean, it actually uploads little images but when it comes to upload big files (that can be even images and songs) it shows error 1. Here it's the code i've used:

<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

OTHER FILE:

<?php


$uploaddir = '';
$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";
}

print_r($_FILES);

print "</pre>";


?>

the problem is that even if i change the value in name="MAX_FILE_SIZE" value="" /> i can't upload those "big" files. I've already changed the value in the php.ini file to 20M

bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • sounds like a server issue. we need more info. what is the output of the server log when you try to upload the song? can you post the source of move_uploaded_file? – Chris Drappier Mar 23 '12 at 18:42
  • Reference http://stackoverflow.com/questions/3263480/upload-max-size-in-php – Mike B Mar 23 '12 at 18:42
  • when i try yo upload a large file like a song it says Possible file upload attack! Array ( [userfile] => Array ( [name] => DSC_0929.jpg [type] => [tmp_name] => [error] => 1 [size] => 0 ) ) move_uploaded_file is the basic php function – Thomas La Licata Mar 23 '12 at 18:44

1 Answers1

0

Error Messages Explained

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

http://php.net/manual/en/features.file-upload.errors.php

jessica
  • 3,051
  • 2
  • 30
  • 31