简体   繁体   中英

Laravel 5.0 Get uploaded file path

I'm uploading a file through a form.

When I dump the file with $request->file("slide") it returns an UploadedFile object but it haven't a method to get the path to the temporal file.

How can I get it?

I need the path to modify the image with Intervention Image before saving it to disk.

Looking into the code I found the solution. UploadedFile extends from File and File extends from SplFileInfo so I can use its methods to access the paths:

$object->getPath();

你应该试试

$request->file('slide')->getPathName();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM