简体   繁体   中英

What is best practice for save large form data in laravel with approx 20 fields and multiple image uploads and video upload

I am working on a project which is having a form for some product to save it includes approx 20+ field and also have multiple images upload (3 max.) and 1 video to be upload.

I am looking for the best practice i can go with that. As submitting all data and files at once will take long time to submit the form.

In your case you should use queue .
1. You create a job, for example

php artisan make:job MediaUpload

2. Write your upload logic inside handle() function

public function handle(Request $request)
{
   // Process uploaded podcast...
}

3. Dispatch this job in your Controller

MediaUpload::dispatch($request);

PS: Don't forget to configure your queue as shown in the link above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM