--- js/imce.js 2010-10-20 14:37:05.000000000 -0400 +++ js/imce.js 2010-10-20 15:38:37.000000000 -0400 @@ -429,10 +429,36 @@ navCache: function (dir, newdir) { }, /**************** UPLOAD ********************/ +//check to see if the file being uploaded exists +fileExistCheck: function(path) { + var path = path; + var found = 0; + var file = $('#file-list tr td.name:contains(' + path + ')'); + if(file.length > 0){ + found = 1 + } + if(found == 1){ + var answer = confirm(path + ' already exists. Overwrite this file?'); + if(answer == false){ + return false; + } else{ + return true; + } + } + return; +}, + + //validate upload form uploadValidate: function (data, form, options) { var path = data[0].value; if (!path) return false; + if(imce.upload_method == 1){ + var exist = imce.fileExistCheck(path); + if (exist == false){ + return false; + } + } if (imce.conf.extensions != '*') { var ext = path.substr(path.lastIndexOf('.') + 1); if ((' '+ imce.conf.extensions +' ').indexOf(' '+ ext.toLowerCase() +' ') == -1) { --- inc/imce.page.inc 2010-10-20 14:37:58.000000000 -0400 +++ inc/imce.page.inc 2010-10-20 15:39:33.000000000 -0400 @@ -51,6 +51,7 @@ function imce_content($user, $jsop = NUL drupal_add_js($path . '/js/jquery.form.js'); drupal_add_js($path . '/js/imce.js'); drupal_add_js($path . '/js/imce_extras.js'); + drupal_add_js("imce.upload_method = " . drupal_to_js(variable_get('imce_settings_replace', FILE_EXISTS_RENAME)) . ";", 'inline'); drupal_add_css($path . '/css/imce-content.css'); //process forms.