Pastor Steve wrote: > Greetings, > > I am getting an error when I am trying to upload a PDF file through a > script. > > When I do a print_r($_FILES) I get the following: > > Array > ( > [userfile] => Array > ( > [name] => document.pdf > [type] => > [tmp_name] => > [error] => 2 > [size] => 0 > ) > > ) > > Docs and html will both upload. Anybody have an idea why? > > Here is the script that I am using: > > <?php > // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used > instead > // of $_FILES. > > $uploaddir = '../cms/documents/'; > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); > > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { > $filename = $_FILES['userfile']['name']; > > echo "<b>File is valid, and was successfully uploaded.</b>\n > <br />Select and copy the link below to reference this file.<p /> > <pre><a href=\"documents/$filename\">$filename</a></pre><p > /> > <b>WARNING:</b> This link will not be available anywhere else. > > "; > > } else { > echo "Possible file upload attack!\n"; > } > > echo '<pre>'; > > echo 'Here is some more debugging info:'; > print_r($_FILES); > > print "</pre>"; > > ?> > > Thanks, > The error number tells you what is happening - check the values at http://php.net/manual/en/features.file-upload.errors.php Essentially, the file is bigger than the MAX_FILE_SIZE directive that was specified in the HTML form Cheers -- David Robley Couldn't myself have better it said. Today is Sweetmorn, the 46th day of Chaos in the YOLD 3174. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php