File Upload Problems
Posted: Sun Oct 24, 2010 4:27 pm
I am trying to setup a simple file upload script and its not working for some reason that I cannot figure out. I have /mnt/tmp setup as the temp directory and I want to upload a file to the server and store it there so I can look at it later. However, when I upload a file to the server nothing appears in the folder. Permissions on /mnt/tmp are 777. I am running php5 on Ubuntu.
php.ini - File Uploads
file_upload.php:
I have read multiple guides online and can not figure out why the files are not uploading. Any help is greatly appeciated.
php.ini - File Uploads
Form:;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir = /mnt/tmp
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 8M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
Code: Select all
<form action="file_upload.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /> <br />
<input type="submit" name="submit" value="Submit" />
</form>
Code: Select all
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES['file']['error'] . "<br />";
} else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
echo "Error Code: " . $_FILES['file']['error'] . "<br />";
}