Skip to content

Commit

Permalink
fix a bug when uyploading pictures for multi-url
Browse files Browse the repository at this point in the history
  • Loading branch information
emarguin committed Sep 24, 2015
1 parent 90e2852 commit 0957113
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main/admin/access_url_edit.php
Expand Up @@ -45,6 +45,10 @@
if ($_FILES[$image_field]['error'] == 0) {
// Hardcoded: only PNG files allowed
if (end(explode('.', $_FILES[$image_field]['name'])) == 'png') {
if(file_exists($url_images_dir.$url_id.'_'.$image_field.'.png')) {
// if the file exists, we have to remove it before move_uploaded_file
unlink($url_images_dir.$url_id.'_'.$image_field.'.png');
}
move_uploaded_file(
$_FILES[$image_field]['tmp_name'],
$url_images_dir.$url_id.'_'.$image_field.'.png'
Expand Down

0 comments on commit 0957113

Please sign in to comment.