Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

How to convert url into UploadedFile class for upload ?

On laravel site I make some actions from console command with image uploaded as parameter of some class, defined with UploadedFile class. I need to upload some file from /public/init sudirectory and I have url to this file, but how can I send it as request with UploadedFile class ?

    "laravel/framework": "^9.19",

Thanks in advance!

0 likes
3 replies
webrobert's avatar

There’s a whole free course here. Laravel 8 from scratch.

You’ll want a controller and a route in your web file.

jlrdw's avatar

To add there is a chapter in the documentation covering the file system.

martinbean's avatar
Level 80

@petrogromovo Why do you need to convert it to an UploadedFile class if it’s a console command? That class is specifically for files uploaded in a HTTP request.

If you’re trying to save a file from a URL then just use a HTTP client to download the file and save the contents to disk.

1 like

Please or to participate in this conversation.