mercredi 23 septembre 2015

When upload image second time using same name using laravel 5 but showing old image on browser

Before uploading check if file exists then delete this image and upload new image using laravel functionality but showing first uploaded image when hitting image url on browser.

I have face this issue when file name and file type are same.

Below my code

$destinationPath = "public/".$destinationPath;
            $extension = $file->getClientOriginalExtension();
            if($file->isValid() && in_array($extension, $allowedExt)) {
                if (\File::exists($destinationPath..$fileName)) {
                    \File::delete($destinationPath.$fileName);
                }
                if($file->move($destinationPath, $fileName)) {
                    return true;
                }
            } return false;

Also I have cleared all cache and tried on another PC.

Please give me Any suggestions to resolve this issue.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire