我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

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.

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();

You should try

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

近期文章

  • 将PHP文件转换为XML / ICS文件
  • 如何使用以下条件在Symfony2 / SwiftMailer服务中发送电子邮件?
  • PHP / SQL插入到表的中间?
  • PHP奇怪的事情发生了卷曲
  • PDOStatement中可捕获的致命错误
  • PHP:json_encode困境,包含无效UTF8的字符串? utf8_encode每个字符串都可以吗?
  • 预订日历到达和离开日期
  • 在Windows上调试php Curl的步骤
  • 单击YII1后,验证码不会更改
  • foodcrud渲染不渲染表格
  • 如何使用bootstrap制作动态时间轴? [关闭]
  • 解码函数中的str_replace不起作用
  • 使用Apache2执行Puppet Virtualhost
  • 表与hasManyThrough之间的关系
  • PHP - 检索访问令牌 - 禁用隐式OAuth
  • 将数字字符串转换为数组键的数量
  • PHP如果变量不为空,则执行mysql多次插入
  • 是否可以通过PHP或Apache从客户端获取网络域?
  • Symfony 2通过谷歌的传输速度非常慢
  • CKFinder:创建上传日志

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华