i have a code that download files of several types(jpg,pdf,jpge,etc) and is working perfectly fine in local development(with laragon) php 7.4
but in my laravel forge with digital ocean(ubuntu 18.04) (php 7.4 for the site of the question)
is only donwloading correctly the .pdf files, the .jpg or .jpeg are being downloaded but when i try to open them in my windwos it say 'it looks like we dont support this file format'.
i used the 3 or 4 same files from local testing and production testing, only in production and for those types are wrong.
the thing that drives me crazy is that if i use scp to bring me the files stored in storage/app/..... of the production server and try to open them, the files are fine and opening well, but when only in production i try to donwload them trhough the app it corrupts the format aparently.
i dont know why is working in local and not in production. mi code for donwloading them is
public function download(File $file)// i have a model File with a property path in the db
{
if (File::exists($file->path)) {
return Storage::download($file->path);
}
abort(404);
}
i also try using response->download alternative, same results i also try using both alternatives mention before with adding the 3rd argument with $headers = ['Content-Type: application/pdf'];
no luck, what i really dont understand is
-this was working a few months/years ago in the same production env/configuration. -this is only not working in production for jpg and jpeg, but in local it is working perfectly fine
any guidance would be much apreciate this proyect is old and is on laravel 5.7
i described everything already