The issue you're experiencing is likely related to the file size limits set in your PHP configuration or the server configuration, despite your php.ini settings appearing to allow for larger uploads. Here are a few steps to troubleshoot and resolve the issue:
-
Check PHP Configuration:
- Ensure that the
php.inifile you edited is the one being used by your server. You can verify this by creating a PHP file withphpinfo();and checking theLoaded Configuration Filepath. - Double-check that
upload_max_filesizeandpost_max_sizeare indeed set to50Min the activephp.ini.
- Ensure that the
-
Check Web Server Configuration:
- If you're using Apache, check the
.htaccessfile or the Apache configuration files for anyphp_valuesettings that might overridephp.ini. - If you're using Nginx, ensure that the
client_max_body_sizedirective is set to a value larger than your file size (e.g.,client_max_body_size 50M;).
- If you're using Apache, check the
-
Check Laravel Configuration:
- Ensure that your Laravel application is not imposing additional file size limits. Check
config/filesystems.phpand any middleware that might affect file uploads.
- Ensure that your Laravel application is not imposing additional file size limits. Check
-
Error Handling:
- Since you're not seeing the second log message, the validation might be failing. Ensure that the file type and size are within the allowed limits specified in your validation rules.
- Add error logging to capture any exceptions or validation errors:
public function store(Request $request) { Log::info('hi from store method'); try { $request->validate([ 'file' => 'required|mimes:pdf,jpeg,gif,png|max:65536', ]); Log::info('validation OK'); // Proceed with file storage logic } catch (\Exception $e) { Log::error('Validation or upload error: ' . $e->getMessage()); return back()->withErrors(['file' => 'File upload failed.']); } } -
Check for Client-Side Issues:
- Ensure that the mobile device is not causing issues with the file upload. Test with different devices or browsers to rule out client-side problems.
By following these steps, you should be able to identify and resolve the issue with uploading files from a mobile device. If the problem persists, consider checking server logs for more detailed error messages.