How to external URL image (download/ copy)
My code
$sourceFilePath = $url;
$destinationPath =public_path()."/uploads/finalAdmitted/";
$success = \File::copy($sourceFilePath,$destinationPath);
@sabbir345 is the $sourceFilePath a url of an external image that you are trying to copy to your project?
You can use file_get_contents() function to fetch the image file.
Please do write more details about the issue, otherwise people will reply based on assumptions. There is a similar question here: https://laracasts.com/discuss/channels/laravel/storing-image-file-retrieved-from-external-url
use Storage;
$url = "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png";
$contents = file_get_contents($url);
$name = substr($url, strrpos($url, '/') + 1);
Storage::put($name, $contents);
Yes @ricus .
$sourceFilePath is external image path
Please or to participate in this conversation.