Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 7 donwload files in Google Chrome/Safari/Fire Fox mobile error #91

Open
felipe-machado09 opened this issue Nov 30, 2020 · 3 comments

Comments

@felipe-machado09
Copy link

Hello,

When I try to download to my phone using the google chrome browser

the error returns to the server problem but when i do it using the computer the same process i have no problems

I tested on
Safari
Firefox
Google Chrome

and in these above I got the error

but when I tested it on the Samsung S10 + phone's native browser it downloads successfully

I don't know what to do anymore because this error doesn't make sense

i upload one video in wetransfer but the link expires in one week if wanna link again ask me

https://we.tl/t-TVs7coZME8

note: i'm doing this way to go less to the google api because as i already have the data in the front listing i just send it to the controller also

WhatsApp Image 2020-11-29 at 22 59 19

`public function downloadFile(Request $request) {

    $user = Auth::user();
    $name = $request->input('name');
    $type = $request->input('type');
    $path = $request->input('path');
    $filename = $request->input('filename');
    $extension = $request->input('extension');
    $timestamp = $request->input('timestamp');
    $mimetype = $request->input('mimetype');
    $size = $request->input('size');
    $dirname = $request->input('dirname');
    $basename = $request->input('basename');

    $historico = new DonwloadHistory();

    $historico->user_id = $user->id;
    $historico->name = $name;
    $historico->type = $type ;
    $historico->path = $path;
    $historico->filename = $filename;
    $historico->extension = $extension;
    $historico->timestamp = $timestamp;
    $historico->mimetype = $mimetype;
    $historico->size = $size;
    $historico->dirname = $dirname;
    $historico->basename = $basename;
    $historico->save();

    $rawData = Storage::cloud()->get($path);


    
    return response($rawData, 200)
        ->header('ContentType', $mimetype)
        ->header('Content-Disposition', "attachment; filename=$name");

    // return response($rawData, 200)
    //     ->header('ContentType', $file['mimetype'])
    //     ->header('Content-Disposition', "attachment; filename=$fileName");
}`
@ivanvermeyen
Copy link
Owner

Hi, can you see in the Laravel log what the exception is?

@felipe-machado09
Copy link
Author

hello thanks for the quick answer did you get to watch the video?

I looked at the log and there was no error about the download

why wouldn't it be possible to use response () -> download () ?

@ivanvermeyen
Copy link
Owner

ivanvermeyen commented Dec 3, 2020

Logically, if it works on other browsers/devices then the server <> Google part is working.
So it must the Chrome browser on the phone.

Can this be related to this issue, thus just a Chrome bug?
nextcloud/server#421

Their solution:
nextcloud/server#1454

Not sure how to apply this to Laravel though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants