Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

deladels's avatar

Processing file uploads in the background

As per my knowledge, there's no current way where a file will be passed to a job because of serialisation and other factors. That said, is there a way to process file uploads in the background or has anyone had this use case before and how did you go about it.

Use Case

I am running a small Laravel 7 app at work where the users can upload some files that come in.The files are then uploaded to Digital Ocean Spaces and some records in the database updated after a successful upload.

I have noticed when a lot of users are uploading at the same time there's an increase in load hence my reason for wanting to process the file uploads using a job.

Any advise or tips could really help.

0 likes
3 replies
edoc's avatar

Why don't you move a file to a folder first, and then queue a file upload?

edoc's avatar

I should have been more specific. @deladels

  1. Move a file to a local folder and get a file path
  2. Pass the path to a job and queue up a file upload
  3. Upload the file from the local folder to the digital ocean server
  4. Update the corresponding model with the path to the file on the DO server
  5. Delete the original file you moved
deladels's avatar

@edoc actually, that's what was on my mind. That said, I had implemented that before. The thing is, the app is on Heroku which uses an ephemeral system so we had the situation where files didn't reflect in spaces because the dynos where restarted at some point by Heroku and all files were flashed.

Please or to participate in this conversation.