From WolfTech
Revision as of 10:36, 22 January 2009 by Rjhodson (talk | contribs)
Jump to navigation Jump to search

To allow IMCE to work on Drupal 6 on the Engineering Servers, you need to replace the following in modules/imce/inc/ (line 467):

$temp = tempnam(realpath(file_directory_temp()), 'imc');


//$temp = tempnam(realpath(file_directory_temp()), 'imc');
$temp = @tempnam(file_directory_temp(), 'imc'); //WOLFTECH CHANGES MADE

In includes/ (line 117),


if (!is_file($file)) {


if (!is_uploaded_file($file) && !is_file($file)) {

In includes/ (line 572),


if (!move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {


if (!@move_uploaded_file($_FILES['files']['tmp_name'][$source], $file->filepath)) {

Altering the Theme to work with IMCE

  • add this function to your current theme's template.php file.(create it if you don't have it. make sure it has <?php at the beginning.)
      function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
        static $access, $integrated;

        if (!isset($access)) {
          $access = function_exists('imce_access') && imce_access();

        $init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running);

        if ($init && $access) {
          $init['file_browser_callback'] = 'imceImageBrowser';
          if (!isset($integrated)) {
            $integrated = TRUE;
            drupal_add_js("function imceImageBrowser(fid, url, type, win) { +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');

        return $init;
  • Go to admin/settings/performance and Clear cached data (at the bottom).
  • Make sure your users have access to IMCE (admin/settings/imce)
  • Clear your browser's cache and start testing.
  • In case of a failure, try alternative themes or browsers and report back with details.