I'm using Laravel, PHP7, PHP-FPM, APCu and NGINX.
I have an HTML form where a user can upload a file, it connects to Upload.php.
File Process:
- validate
- name
- move from /tmp to /media
- create thumbnail
- create database record
Once the PHP script reaches a certain point, how can I have it continue running even if the user exits the upload page early? Or else a rogue file will be left in the directory without a database entry.
// Move uploaded file from /tmp to /media
Input::file('file')->move("/var/www/mysite/media", $image);
// Continue even if user exits early
// prevent a file in /media from not having a database record
// Thumbnail creation and other operations here
// May take several seconds
// Save database record
$image = new Gallery();
$image->name = $name;
$image->created_at = $date;
$image->save();
Should I use ignore_user_abort(true)
and wrap the operations in a while(true)
?
I have other bools in the script such as $upload = true
. How does the while(true)
know to represent ignore_user_about(true)
and not another bool I have set?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ol9FFZ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire