This is an old revision of the document!
Upload Large Files
In many site applications, user can upload files, some could be big file , like 1GB or bigger, but when upload such large file, many setting could have put a limit on it and cause you failed to upload it, here are some setting you may need to check when have upload failure on large file.
On external app part (typically PHP), you may need to check :
1. upload_max_filesize
2. post_max_size
3. max_execution_time (some PHP script may need to do some afterward process, like resizing or watermarking, somax_execution_time could also affect it)
4. memory_limit
5. upload_tmp_dir (by default this would be /tmp , maybe system comes with default as 2GB in size , which if you upload a file bigger than 2GB, then it will undoubtedly fail because not enough disk space to save temporary file.)
On LiteSpeed WebServer part, you may need to check:
1. Swapping Directory in Server Configuration > General (some reason for PHP's upload_tmp_dir )
2. Max Request Body Size (bytes) in Server Configuration > Tuning
3. External App Timeout , please check this page for further detail.
4. Memory Soft Limit (bytes) and Memory Hard Limit (bytes) in External App , if you don't see any PHP shows up in External App then please go to PHP tab instead, raise from default ``2047M`` to a higher number , you can blindly raise it to something like `20470M` for test purpose.
5. wait-req-full-body , please check this page for further detail.
Test
Here is a simple PHP upload script , you can use it to test the upload with large files.
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); echo "uplaod max size: ".ini_get('upload_max_filesize'); echo "<br>"; echo "post max size: ".ini_get('post_max_size'); echo "<br>"; echo "max execution time : ".ini_get('max_execution_time'); echo "<br>"; echo "memory limit: ".ini_get('memory_limit'); echo "<br>"; echo "upload tmp dir: ".ini_get('upload_tmp_dir'); echo "<br>"; echo "<br>"; if(isset($_FILES['test'])){ $errors= array(); $file_name = $_FILES['test']['name']; $file_size =$_FILES['test']['size']; $file_tmp =$_FILES['test']['tmp_name']; $file_type=$_FILES['test']['type']; if (!file_exists('upload_test')) { mkdir('upload_test', 0777, true); } if(empty($errors)==true){ move_uploaded_file($file_tmp,"upload_test/".$file_name); echo "Success"; }else{ print_r($errors); } } ?> <html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="test" /> <input type="submit"/> </form> </body> </html>
this will simply to determinate if there is something wrong with PHP/LSWS or your site application.
If this script uploading works , but your site's uploading is not working properly , then probably something wrong in your site code , you may need to check on that.