Trouble with chmod after upload

-Shaman- - October 13, 2009 - 14:39

I'm using yui editor module but after upload files are 600 instead 644, I tried put somewhere this bit of code: $chmod = chmod($path, 0766); //set the appropriate permissions. but i'm not sure where exactly it should be in this part of module's code responsible for upload below:

<?php
/**
* Menu-callback for JavaScript-based uploads.
*/
function yui_editor_image_upload() {
 
header("content-type: text/html"); // the return type must be text/html
 
$response = null;
 
$path = file_directory_path();

 
//Append trailing slash to path if not there
 
if (! (substr($path, -1) == '/')) {
   
$path .= '/';
  }
 
$path .= 'images';
 
$file = file_save_upload('upload', array(), $path, FILE_EXISTS_REPLACE);
  if (!
$file) {
   
$response->status = 'Error Reading Uploaded File.';
    print
drupal_to_js($response);
    exit;
  }
 
 
$response->status = 'UPLOADED';
 
$response->image_url = $file->filepath;

  print
drupal_to_js($response);
  exit;
}
?>

I'm writing here instead of filing new issue on the project page, because perhaps here will be more people which could help, as this is more broad issue not really module specific.

 
 

Drupal is a registered trademark of Dries Buytaert.