I need to upload a folder using laravel. How do i do?
And then how to store a mysql database and how to select folder data
I uploaded but sub file doesn’t contains at uploaded folder in laravel.
If you can , please tell me how to upload a folder in laravel and how to store in mysql database?
2
Answers
Allowing folder uploads in any application can introduce potential security risks and performance issues. Your application would become vulnerable to malware injection and other security risks commonly associated with web development.
Instead, you can consider allowing users to upload zip files. This approach provides better security as the uploaded files can be scanned and extracted in a controlled manner. For more information on file uploads in Laravel, you can refer to the official documentation at https://laravel.com/docs/10.x/filesystem.
Try to upload your files as multiple files.
<input type="file" name="files[]" multiple/>
So when file selector dialog appears, user can select multiple files inside your folder.
Make sure you understand basic tutorial about laravel file storage Laravel File Storage.
The last, use foreach to store the file into disk and and also insert it’s label or filename (as file path) to database using eloquent or DB query insert.
Both storing file to disk and database are done.