我正在尝试使用storeAs()将文件上传到Laravel中的public / attachments / foo.jpg,它在ubuntu中正常工作,但在Windows中无法正常工作。
if($isValidated){
$newFileName = '';
foreach($files as $upload){
$fileName = preg_replace('/\s+/', '_', pathinfo($upload->getClientOriginalName())['filename']);
$newFileName = $fileName.'_'.$upload->uploadTime.'.'.$upload->getClientOriginalExtension();
$upload->storeAs('public/attachments', $newFileName);
}
}
此代码块成功上传了/public/attachments/foo.jpg
中的文件
但是,当我在Windows平台上尝试此操作时,出现错误消息fopen ... failed to open stream : Invalid aruguments.
我附上错误的screenshot。
注意:
我已经像这样php artisan:storage link
使用Laravel 5.4
答案 0 :(得分:0)
问题在文件名中。它包含冒号:
,在Windows中是不允许的。