Absolutely, this is a common scenario when deploying to production servers like those managed by Laravel Forge!
Here's how you can handle it:
1. Manually Upload via SFTP/SSH
Yes, you can simply upload the default_avatar.png via SFTP or SSH directly to the storage directory on your Forge server.
Steps:
- Connect to your server via SFTP or SSH.
- Navigate to your Laravel project directory, then go to
storage/app/public/authors/. - Upload your
default_avatar.pngfile into that directory.
Note: If the
authorsfolder does not exist, create it first.
2. Ensure Proper Symbolic Link
Make sure you've run:
php artisan storage:link
on your production server. This will ensure that the public/storage symbolic link points to storage/app/public and your images are served correctly.
3. Set Correct Permissions
Depending on your server configuration, ensure the uploaded file has the correct file permissions so that the web server can serve it:
chmod 664 storage/app/public/authors/default_avatar.png
(or use chmod -R 775 storage for broader coverage)
4. (Optional) Automate during Deployment
For repeated deployments, you can add a deployment script/step (in Forge or your CI pipeline) to copy this image into place.
5. Alternative: Keep in Public Directory
If you don't mind the image being truly public and not managed via Laravel's storage system, you could place default_avatar.png in public/images/authors/ and set your path accordingly.
Summary:
Yes, uploading the file via SFTP/SSH is the quickest solution for occasional/single files not managed in version control. Make sure the storage symlink exists and permissions are correct.
Let me know if you need code examples or more automated approaches!