here what i need to do for avoiding extra comma separater while upload the images.it takes one more image while upload the file.i used comma separater for the concatination.
Controller
$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,
);
Views
<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>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1SiLnn2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire