Cant download file from storage
I have created a file in a directory using makeDirectroy(). Then Im trying to download it using storage::download(), response->file(), response->download(), I ALSO tried using controller but none of them are working either... Im very stuck and confused...
I have a private storage if you're wondering
Does it have to do with permissions or something?
31 Replies
What is calling downloadDocument?
In my actions this is usually good:
my header action in my page is calling it. downloadDocument() is ina trait
I just tried your command as well and didnt work.
Do you have something wrong as that works perfectly in all my situations.
Are you on windows?
Linux
Doulbe check permissions are set right... but it should be good
Ok wait. I have to inform you I'm building a plugin
The directory has read/write permissions
This is the directory
Here are the files (and the pdf i want to get)
I suspect that mateo doesn't have access to the files then.... the web server will be requesting them
Im mateo
How can I not have permissions
should I give it www-data?
usually it would be www-data if www-data is the one requesting to send the data yes.
who is is the web server running under?
Its running on localhost
at the moment
it can run on localhost but the webs erver will be under a user
so what should I do then?
Im still a bit lost
Still no download, but I have this in the logger:
Im just gonna go ahead and share the whole function:
You are telling it it must return a binary response, firstly remove that and test without that strict condition
I tried, its still the same
try this
Will do, Sorry for late response. I had some linux issues 😅
Its still nothing
What the hell...
As I said in the beginning its in a private storage, does that matter?
Yes if it's s3?
Som the private storage engine will need fetching and storing as a url download
Sorry I assumed it was localised out of http scope
No it's local private storage
Not s3
should be fine as we ready the file and send it
okay wth
im confused
I think the process is causing the issue @toeknee
In the action, if I just have
Then it works
But how can I overcome this issue? I need to use the pdflatex binary
You will need to debug why it is doing that, you should be able to return it
ufff
just discovered something. Before I said that I tried download without process and it wokred. Well I tried it in the ->action() callback. The download function is in a trait. And inside a trait, it doesnt work.
This while function works inside the ->action() but not in a trait
WHat?? 🤣
Where are you attaching the trait from? I suspect the trait is outside the action and as such isn't returned directly as part of the action.
Maybe use a helper instead of a trait
OH MY GOD
I had to do
I had to use return?? That made the whole difference
Of course! How else does the action know to return?
That was in the above though
good point. When I used the function without the return, the compilation still happened
I just never got the download prompt
Thank you for sticking with me :D
learned smth new
That makes sense