doujiu7704
2015-07-10 18:29
浏览 63
已采纳

Laravel 5.0获取上传的文件路径

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.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • drouie2014 2015-07-10 18:31
    已采纳

    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();
    
    已采纳该答案
    打赏 评论
  • dthhlf1777 2016-12-06 13:55

    You should try

    $request->file('slide')->getPathName();
    
    打赏 评论

相关推荐 更多相似问题