Reputation: 130
i got a problem uploading files into Heroku app, using Laravel 5.1 framework and Clear DB ad-dons in Heroku.
Already read Laravel docs, but i think the problem is in the save method...
i mean in local mode it works fine :
1) \Storage::disk('local')->put($name, \File::get($file));
or
2)
$name = $request->file->getClientOriginalName();
Storage::put($name,
file_get_contents($request->file('path')->getRealPath())
);
I use "\Storage::disk('local')" because i supose 's3' for amazon and Rackspace Cloud Storage... shall i use disk('web') or something like that?
any suggestion?
Upvotes: 1
Views: 2080
Reputation: 32629
Every dyno in heroku is an independent container sharing nothing with the other. That means files written on disk will not be available to other dynos, and will be lost as soon as the app is restarted or redeployed.
See https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem
Because of this, you cannot rely on the local filesystem (it would break 12factor). You need to store them on a distant platform like Amazon S3.
See https://devcenter.heroku.com/articles/s3-upload-php
Upvotes: 2