Jump to content

Upload file fail


Recommended Posts

I'm running a script to upload files.  It works fine until I try to upload files bigger than about 200K.  Anyone know what could be going wrong?  I tried adjusting max file size in php.ini but it did not fix the issue.

 

Here is my upload script

<?php
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo "<p>";

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}

?>

 

And the line for post max size in php.ini

 

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size = 80M

 

Here is the section of my php.ini that has to do with file uploads

 

;;;;;;;;;;;;;;;;
; 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 =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 20M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

Link to comment
https://forums.phpfreaks.com/topic/282400-upload-file-fail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.