Why Are File Uploads Failing?
File upload failures can occur for several reasons, from PHP configuration limits to file permission issues. This guide will help you identify and resolve the most common causes.
Common Causes
- File size exceeds PHP limits – PHP has two settings that control upload sizes:
upload_max_filesizeandpost_max_size. The default is often just 2MB. - File type not allowed – Your CMS or application may restrict uploads to certain file types for security reasons.
- Insufficient disk space – If your hosting account has run out of disk space, no new files can be written.
- Incorrect folder permissions – The upload destination folder needs write permissions (typically
755for the directory). - PHP memory limit – Processing large uploads requires memory. If the memory limit is too low, the upload will fail.
- Script timeout – Large files take longer to upload and process, potentially exceeding the PHP execution time limit.
How to Fix It
- Increase PHP upload limits – In cPanel, go to MultiPHP INI Editor and increase these values:
upload_max_filesize = 64Mpost_max_size = 64Mmemory_limit = 256Mmax_execution_time = 120
- Check disk space – In cPanel, the sidebar shows your disk usage. Delete unnecessary files, old backups, or emails to free up space.
- Fix folder permissions – Ensure the upload directory has permissions set to
755. The files inside should be644. - Whitelist the file type – If your CMS blocks certain file types, check its settings to add the file extension to the allowed list.
- Use FTP for large files – If you need to upload files larger than 100MB, use an FTP client like FileZilla instead of the web-based uploader.
After making changes to PHP settings, you may need to restart PHP or wait a few minutes for the changes to take effect. Contact support if uploads continue to fail.