Download and store a file from an external api to my server
I am creating an app that relies on gathering content from an external api. The api provides links to a series of images that I need to download and store on my server.
The following solution appears to have worked years ago, found here:
Apparently, UploadedFile requires the data to be included in the global $_FILES array in order to gain access to all the helpful tools like store() and storeAs().
@docmojoman I've had a quick look at the code base, and I don't see what would be preventing you from using it?
What version of Laravel are you using?
And what does dd($uploaded_file) export?
As for your response in that referenced thread, I don't think a mime type of application/octet-stream means failure, it's just the default setting if you don't provide one within the constructor.
Can you not just use Storage::put()? What tools are you trying to gain access to via UploadedFile that is making you go thru this trouble?
You cant use the uploaded file object because that is for things that are posted to your server, but you can just getFileContents and write it to storage (as @talinon said earlier)