jk1112 Posted September 24, 2013 Share Posted September 24, 2013 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-sizepost_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-uploadsfile_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-filesizeupload_max_filesize = 20M; Maximum number of files that can be uploaded via a single requestmax_file_uploads = 20 Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/ Share on other sites More sharing options...
Ch0cu3r Posted September 24, 2013 Share Posted September 24, 2013 When you modified php.ini did you restart your http server? Depending on how the server is setup you need to restart http server for changes to php.ini to take effect. Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/#findComment-1451019 Share on other sites More sharing options...
jk1112 Posted September 24, 2013 Author Share Posted September 24, 2013 Yes, I restarted multiple times. Both apache itself and the actual machine . Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/#findComment-1451026 Share on other sites More sharing options...
Ch0cu3r Posted September 24, 2013 Share Posted September 24, 2013 Are you sure PHP is reading the php.ini? Can you confirm echo php_ini_loaded_file() . '<br />'. ini_get('upload_max_filesize'); outputs 20M and the correct path to the php.ini file you're editing Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/#findComment-1451033 Share on other sites More sharing options...
jazzman1 Posted September 24, 2013 Share Posted September 24, 2013 @jk1112, does your html form have an enctype attribute itself? Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/#findComment-1451034 Share on other sites More sharing options...
jk1112 Posted September 24, 2013 Author Share Posted September 24, 2013 @jk1112, does your html form have an enctype attribute itself? Ah, I can't believe I overlooked that. Max file size was being specified in the HTML document itself. Works great now! Thanks everyone! Link to comment https://forums.phpfreaks.com/topic/282400-upload-file-fail/#findComment-1451045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.