这里我需要做的是在上传图片时避免额外的逗号分隔符。在上传文件时需要再拍摄一张图片。我使用逗号分隔符进行连接。
控制器
$filename_new_get = "";
$count = Input::get('count');
for($i = 0 ; $i < $count ; $i++)
{
$file_more = Input::file('file_more'.$i);
$file_more_name = $file_more->getClientOriginalName();
$move_more_img = explode('.',$file_more_name);
$filename_new = $move_more_img[0].str_random(8).".".$move_more_img[1];
$newdestinationPath = '../assets/categoryimage/';
$uploadSuccess_new =Input::file('file_more'.$i)->move($newdestinationPath,$filename_new);
$filename_new_get .= $filename_new.",";
}
$inputs = Input::all();
$file = Input::file('file');
$filename = $file->getClientOriginalName();
$move_img = explode('.',$filename);
$filename = $move_img[0].str_random(8).".".$move_img[1];
$destinationPath = '../assets/categoryimage/';
$uploadSuccess = Input::file('file')->move($destinationPath,$filename);
$file_name_insert = $filename . ",".$filename_new_get;
$data=array(
'new_category_image'=> $file_name_insert,
);
浏览
<div class="col-lg-8" id="img_upload">
<input type="file" id="file0" name="file" style="background:none;width:185px;border:none;">no files
<div id="divTxt"></div>
<p><a onClick="addproductimageFormField(); return false;" style="cursor:pointer;color:#F60;width:84px;" id="add_img_btn" >Add</a></p>
<input type="hidden" id="aid" value="1">
<input type="text" id="count" name="count" value="0">
</div>
答案 0 :(得分:0)