示例#1
0
/**
 * 	This function is used to decide the File Storage Path in where we will upload the file in the server.
 * 	return string $filepath  - filepath inwhere the file should be stored in the server will be return
 */
function decideFilePath()
{
    return Vtiger_Functions::initStorageFileDirectory();
}
示例#2
0
 function _SaveAttachmentFile($attachid, $filename, $filecontent)
 {
     require_once 'modules/OSSMail/MailAttachmentMIME.php';
     $adb = PearDatabase::getInstance();
     $dirname = Vtiger_Functions::initStorageFileDirectory('OSSMailView');
     if (!is_dir($dirname)) {
         mkdir($dirname);
     }
     $filename = str_replace(' ', '-', $filename);
     $filename = str_replace(':', '-', $filename);
     $filename = str_replace('/', '-', $filename);
     $saveasfile = "{$dirname}{$attachid}" . "_{$filename}";
     if (!file_exists($saveasfile)) {
         $fh = fopen($saveasfile, 'wb');
         fwrite($fh, $filecontent);
         fclose($fh);
     }
     $mimetype = MailAttachmentMIME::detect($saveasfile);
     $adb->pquery("INSERT INTO vtiger_attachments SET attachmentsid=?, name=?, description=?, type=?, path=?", array($attachid, $filename, $description, $mimetype, $dirname));
     return true;
 }
示例#3
0
/**
 * 	This function is used to decide the File Storage Path in where we will upload the file in the server.
 * 	return string $filepath  - filepath inwhere the file should be stored in the server will be return
 */
function decideFilePath($module = false)
{
    return Vtiger_Functions::initStorageFileDirectory($module);
}