anybody who can help me
Dec 3, 2015
3
Level 2
Delete previous image from folder when updated by new image
How can i delete the previous image from folder when it is update by new image.
my current image update function is like this
public function update($id)
{
$article = Article::find($id);
if(Input::hasFile('image'))
{
$file = Input::file('image');
$name = time() . '-' . $file->getClientOriginalName();
$file = $file->move(public_path() . '/images/profile/', $name);
$article->file= $name;
}
$article->save();
return "success";
}
I want to replace previous images from folder with new updated/uploded images . how can i do this
Please or to participate in this conversation.