Sha*_*jan 2 php image-uploading laravel laravel-5.2
我用 ,
$up = request::file('image')->move('../public/images');
Run Code Online (Sandbox Code Playgroud)
将图像上传到“公共/图像”目录。
我尝试通过使用“dd()”来了解“$up”的数据。
我得到的数据是,
UploadedFile {#183 ?
-test: false
-originalName: "Brackpoints.png"
-mimeType: "image/png"
-size: 148276
-error: 0
path: "/tmp"
filename: "phpmU8PvU"
basename: "phpmU8PvU"
pathname: "/tmp/phpmU8PvU"
extension: ""
realPath: "/tmp/phpmU8PvU"
aTime: 2016-02-15 13:57:39
mTime: 2016-02-15 13:57:39
cTime: 2016-02-15 13:57:39
inode: 1443211
size: 148276
perms: 0100600
owner: 900
group: 900
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试“print_r()”,那么我得到,
Illuminate\Http\UploadedFile Object
(
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => Brackpoints.png
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
[size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 148276
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
[pathName:SplFileInfo:private] => /tmp/phpMhUyh0
[fileName:SplFileInfo:private] => phpMhUyh0
)
Symfony\Component\HttpFoundation\File\File Object
(
[pathName:SplFileInfo:private] => ../public/images/phpMhUyh0
[fileName:SplFileInfo:private] => phpMhUyh0
)
Run Code Online (Sandbox Code Playgroud)
在这里,我想获取图像的名称和类型...
我怎么能得到?
| 归档时间: |
|
| 查看次数: |
4201 次 |
| 最近记录: |