octobercms 中的多个文件上传
Multiple file uploads in octobercms
我只想知道前端octobercms怎么上传多个文件
没有教程,
我正在使用
<input name="posting-image" type="file" multiple="multiple" />
然后只得到最后上传的图片
$posting->posting->image=Input::file('posting-image');
$posting->save();
如何检索所有图像?
嘿,如果你想要多张图片,你需要使用 array[] in name of image/file
因此您需要将输入写为
<input name="posting-image[]" type="file" multiple="multiple" />
<!-- you need to add this ^ array brackets after name -->
posting-image[]
所以现在它可以容纳多张图片,而不仅仅是最后一张图片。
现在您可以简单地使用它在 php 侧获得多个图像
$posting->posting->image= Input::file('posting-image');
// this will return you array of uploaded files
$posting->save();
如有问题请评论。
我只想知道前端octobercms怎么上传多个文件 没有教程,
我正在使用
<input name="posting-image" type="file" multiple="multiple" />
然后只得到最后上传的图片
$posting->posting->image=Input::file('posting-image');
$posting->save();
如何检索所有图像?
嘿,如果你想要多张图片,你需要使用 array[] in name of image/file
因此您需要将输入写为
<input name="posting-image[]" type="file" multiple="multiple" />
<!-- you need to add this ^ array brackets after name -->
posting-image[]
所以现在它可以容纳多张图片,而不仅仅是最后一张图片。
现在您可以简单地使用它在 php 侧获得多个图像
$posting->posting->image= Input::file('posting-image');
// this will return you array of uploaded files
$posting->save();
如有问题请评论。