i have done image update function.The following code updates only the file name in the database but i need to remove the old image from the destination folder too while updating else the folder size will become too large. Any Ideas would be great. Here my code.
public function updateQuoteItemImage($image){
$file=Input::file('filename');
$random_name=str_random(8);
$destinationPath='images/';
$extension=$file->getClientOriginalExtension();
$filename=$random_name.'_quote_itm_image.'.$extension;
$byte=File::size($file); //get size of file
$uploadSuccess=Input::file('filename')->move($destinationPath,$filename);
$data=QuoteItemImage::findOrFail($image->id);
$data->quote_item_id=$image->quote_item_id;
$data->filename=$filename;
$data->filesize=$byte;
$data->save();
return Common::getJsonResponse(true, 'image updated', 200);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire