Deploy Laravel for Bitbucket Pipelines
View on GitHub

Step 7: User uploaded files

Are you storing user uploaded files in the public directory?

(select an option above)

Great, that's how it should be. You can continue to the next step.

Oops, you're not supposed to store user uploaded files in the public directory. This deployment script uses a zero-downtime deployment strategy, which means the "public" directory will get recreated every time you deploy, meaning you'll lose any files you store in there.

When using Laravel (or at least when doing zero-downtime deployments) you have to store your user uploaded files in the storage directory using the storage facade.

Before you can run a deployment using this script you'll have to move the files from your public directory to the storage directory, and change your code to use the storage facade.

Just so you know, you'll have this same issue if you decide to use Laravel Envoyer or Deployer.

OK, that's fine. You can continue to the next step.

Just a reminder: this deployment script uses a zero-downtime deployment strategy (just like Envoyer and Deployer). This means that your "public" directory will get recreated every time you deploy, meaning you'll lose any files you store in there. Always use Laravel's storage facade when storing user uploaded files.