我在view.blade.php
中有这个{!!Form::open(['url'=>'/Path/somepath','method'=>'POST','files'=>true])!!}
<div>
<span>{!!Form::label('Photo','Your photo')!!}</span>
<span>{!! Form::file('Photo')!!}</span>
</div>
{!!Form::close()!!}
我在控制器方法中有这个:
$destinationPath = 'Folder/Subfolder1/Subfolder2';
$extension = Input::file('Photo')->getClientOriginalExtension();
$size = Input::file('Photo')->getSize();
$mime = Input::file('Photo')->getMimeType();
$path = Input::file('Photo')->getRealPath();
$fileName=’ 3da0d12d6d8667963392a446262b1773JJ.jpg’;
$ufile=Input::file('Photo');
$ufile->move($destinationPath, $fileName);
$details=[$size,$mime,$path,$fileName,$ufile];
dd($details);
结果如下:
array:5 [▼
0 => 7673
1 => "image/jpeg"
2 => "C:\wamp2\tmp\php984F.tmp"
3 => "3da0d12d6d8667963392a446262b1773JJ.jpg"
4 => UploadedFile {#29 ▼
-test: false
-originalName: "vali.jpg"
-mimeType: "image/jpeg"
-size: 7673
-error: 0
}
]
但是当我查看C:\wamp2\tmp\
时,文件php984F.tmp
不存在。我的问题是将文件移动到另一个路径不起作用......它无法工作,因为上传似乎不起作用。
那么,我做错了什么?
答案 0 :(得分:1)
更正目标目录路径
$regexp = '/\b[0-9]{5,11}\b/';