当前位置: 首页>>代码示例>>PHP>>正文


PHP dol_move_uploaded_file函数代码示例

本文整理汇总了PHP中dol_move_uploaded_file函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_move_uploaded_file函数的具体用法?PHP dol_move_uploaded_file怎么用?PHP dol_move_uploaded_file使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dol_move_uploaded_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_photo

	/**
	 *  Deplace fichier uploade sous le nom $files dans le repertoire sdir
	 *
	 *  @param  string	$sdir       Repertoire destination finale
	 *  @param  string	$file       Nom du fichier uploade
	 *  @param  int		$maxWidth   Largeur maximum que dois faire la miniature (160 par defaut)
	 *  @param  int		$maxHeight  Hauteur maximum que dois faire la miniature (120 par defaut)
	 *  @return	void
	 */
	function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
	{
		require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");

		$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos";

		dol_mkdir($dir);

		$dir_osencoded=$dir;
		if (is_dir($dir_osencoded))
		{
			$originImage = $dir . '/' . $file['name'];

			// Cree fichier en taille origine
			$result=dol_move_uploaded_file($file['tmp_name'], $originImage, 1);

			if (file_exists(dol_osencode($originImage)))
			{
				// Cree fichier en taille vignette
				$this->add_thumb($originImage,$maxWidth,$maxHeight);
			}
		}
	}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:32,代码来源:product.class.php

示例2:

	}
	else
	{
		if (! preg_match('/\.tgz/i',$original_file))
		{
			$mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
			$error++;
		}
	}

	if (! $error)
	{
		@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
		create_exdir($conf->admin->dir_temp.'/'.$original_file);

		$result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']);
		if ($result > 0)
		{
			//dol_uncompress($newfile);
		}
	}
}


/*
 * View
 */

$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
开发者ID:remyyounes,项目名称:dolibarr,代码行数:30,代码来源:update.php

示例3: handleFileUpload

 /**
  * Enter description here ...
  *
  * @param 	string		$uploaded_file		Uploade file
  * @param 	string		$name				Name
  * @param 	int			$size				Size
  * @param 	string		$type				Type
  * @param 	string		$error				Error
  * @param	string		$index				Index
  * @return stdClass
  */
 protected function handleFileUpload($uploaded_file, $name, $size, $type, $error, $index)
 {
     $file = new stdClass();
     $file->name = $this->trimFileName($name, $type, $index);
     $file->mime = dol_mimetype($file->name, '', 2);
     $file->size = intval($size);
     $file->type = $type;
     if ($this->validate($uploaded_file, $file, $error, $index) && dol_mkdir($this->options['upload_dir']) >= 0) {
         $file_path = $this->options['upload_dir'] . $file->name;
         $append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
         clearstatcache();
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
             } else {
                 dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile');
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         }
         $file_size = filesize($file_path);
         if ($file_size === $file->size) {
             $file->url = $this->options['upload_url'] . rawurlencode($file->name);
             foreach ($this->options['image_versions'] as $version => $options) {
                 if ($this->createScaledImage($file->name, $options)) {
                     $tmp = explode('.', $file->name);
                     $file->{$version . '_url'} = $options['upload_url'] . rawurlencode($tmp[0] . '_mini.' . $tmp[1]);
                 }
             }
         } else {
             if ($this->options['discard_aborted_uploads']) {
                 unlink($file_path);
                 $file->error = 'abort';
             }
         }
         $file->size = $file_size;
         $this->setFileDeleteUrl($file);
     }
     return $file;
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:53,代码来源:fileupload.class.php

示例4: dol_mkdir

            if ($objimport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
                $mesg = '<div class="error">' . $langs->trans("ErrorImportDuplicateProfil") . '</div>';
            } else {
                $mesg = '<div class="error">' . $objimport->error . '</div>';
            }
        }
    } else {
        $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("ImportModelName")) . '</div>';
    }
}
if ($step == 3 && $datatoimport) {
    if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
        dol_mkdir($conf->import->dir_temp);
        $nowyearmonth = dol_print_date(dol_now(), '%Y%m%d%H%M%S');
        $fullpath = $conf->import->dir_temp . "/" . $nowyearmonth . '-' . $_FILES['userfile']['name'];
        if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath, 1) > 0) {
            dol_syslog("File " . $fullpath . " was added for import");
        } else {
            $langs->load("errors");
            $mesg = $langs->trans("ErrorFailedToSaveFile");
        }
    }
}
if ($step == 4 && $action == 'select_model') {
    // Reinit match arrays
    $_SESSION["dol_array_match_file_to_database"] = '';
    $serialized_array_match_file_to_database = '';
    $array_match_file_to_database = array();
    // Load model from $importmodelid and set $array_match_file_to_database
    // and $_SESSION["dol_array_match_file_to_database"]
    $result = $objimport->fetch($importmodelid);
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:import.php

示例5: handle_file_upload

 private function handle_file_upload($uploaded_file, $name, $size, $type, $error) {
     $file = new stdClass();
     $file->name = basename(stripslashes($name));
     $file->mime = dol_mimetype($file->name,'',2);
     $file->size = intval($size);
     $file->type = $type;
     $error = $this->has_error($uploaded_file, $file, $error);
     if (!$error && $file->name && create_exdir($this->options['upload_dir']) >= 0) {
         if ($file->name[0] === '.') {
             $file->name = substr($file->name, 1);
         }
         $file_path = $this->options['upload_dir'].$file->name;
         $append_file = is_file($file_path) && $file->size > filesize($file_path);
         clearstatcache();
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents(
                     $file_path,
                     fopen($uploaded_file, 'r'),
                     FILE_APPEND
                 );
             } else {
                 // FIXME problem with trigger
             	dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 1);
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents(
                 $file_path,
                 fopen('php://input', 'r'),
                 $append_file ? FILE_APPEND : 0
             );
         }
         $file_size = filesize($file_path);
         if ($file_size === $file->size) {
             $file->url = $this->options['upload_url'].rawurlencode($file->name);
             foreach($this->options['image_versions'] as $version => $options)
             {
                 if ($this->create_scaled_image($file->name, $options))
                 {
                     $tmp=explode('.',$file->name);
                     $file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
                 }
             }
         } else if ($this->options['discard_aborted_uploads']) {
             unlink($file_path);
             $file->error = 'abort';
         }
         $file->size = $file_size;
         $file->delete_url = $this->options['script_url']
             .'?file='.rawurlencode($file->name).'&fk_element='.$this->fk_element.'&element='.$this->element;
         $file->delete_type = 'DELETE';
     } else {
         $file->error = $error;
     }
     return $file;
 }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:58,代码来源:ajaxfileupload.php

示例6: BonPrelevement

	Header("Location: fiche.php?id=".$id);
	exit;
}

if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
	require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

	$bon = new BonPrelevement($db,"");
	$bon->fetch($id);

	if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
	{
		$dir = $conf->prelevement->dir_output.'/receipts';

		if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name'],1) > 0)
		{
			$dt = dol_mktime(12,0,0,GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear"));

			$bon->set_infotrans($user, $dt, GETPOST("methode"));
		}

		Header("Location: fiche.php?id=".$id);
        exit;
	}
	else
	{
		dol_syslog("Fichier invalide",LOG_WARNING);
		$mesg='BadFile';
	}
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:fiche.php

示例7: dol_add_file_process

/**
 * Get and save an upload file (for example after submitting a new file a mail form).
 * All information used are in db, conf, langs, user and _FILES.
 * Note: This function can be used only into a HTML page context.
 *
 * @param	string	$upload_dir				Directory where to store uploaded file (note: also find in first part of dest_file)
 * @param	int		$allowoverwrite			1=Allow overwrite existing file
 * @param	int		$donotupdatesession		1=Do no edit _SESSION variable
 * @param	string	$varfiles				_FILES var name
 * @param	string	$savingdocmask			Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
 * @param	string	$link					Link to add
 * @return	void
 */
function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null)
{
    global $db, $user, $conf, $langs;
    if (!empty($_FILES[$varfiles])) {
        dol_syslog('dol_add_file_process upload_dir=' . $upload_dir . ' allowoverwrite=' . $allowoverwrite . ' donotupdatesession=' . $donotupdatesession . ' savingdocmask=' . $savingdocmask, LOG_DEBUG);
        if (dol_mkdir($upload_dir) >= 0) {
            $TFile = $_FILES[$varfiles];
            if (!is_array($TFile['name'])) {
                foreach ($TFile as $key => &$val) {
                    $val = array($val);
                }
            }
            $nbfile = count($TFile['name']);
            for ($i = 0; $i < $nbfile; $i++) {
                // Define $destpath (path to file including filename) and $destfile (only filename)
                $destpath = $upload_dir . "/" . $TFile['name'][$i];
                $destfile = $TFile['name'][$i];
                $savingdocmask = dol_sanitizeFileName($savingdocmask);
                if ($savingdocmask) {
                    $destpath = $upload_dir . "/" . preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
                    $destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
                }
                $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
                if (is_numeric($resupload) && $resupload > 0) {
                    global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
                    include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
                    if (empty($donotupdatesession)) {
                        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
                        $formmail = new FormMail($db);
                        $formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]);
                    }
                    if (image_format_supported($destpath) == 1) {
                        // Create small thumbs for image (Ratio is near 16/9)
                        // Used on logon for example
                        $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
                        // Create mini thumbs for image (Ratio is near 16/9)
                        // Used on menu or for setup page for example
                        $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
                    }
                    setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
                } else {
                    $langs->load("errors");
                    if ($resupload < 0) {
                        setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
                    } else {
                        if (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
                            setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
                        } else {
                            setEventMessages($langs->trans($resupload), null, 'errors');
                        }
                    }
                }
            }
        }
    } elseif ($link) {
        if (dol_mkdir($upload_dir) >= 0) {
            require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
            $linkObject = new Link($db);
            $linkObject->entity = $conf->entity;
            $linkObject->url = $link;
            $linkObject->objecttype = GETPOST('objecttype', 'alpha');
            $linkObject->objectid = GETPOST('objectid', 'int');
            $linkObject->label = GETPOST('label', 'alpha');
            $res = $linkObject->create($user);
            $langs->load('link');
            if ($res > 0) {
                setEventMessages($langs->trans("LinkComplete"), null, 'mesgs');
            } else {
                setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors');
            }
        }
    } else {
        $langs->load("errors");
        setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
    }
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:89,代码来源:files.lib.php

示例8: dol_sanitizeFileName

        $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);

        // Gestion du logo de la société
        $dir     = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
        $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
        if ($file_OK)
        {
            if (image_format_supported($_FILES['photo']['name']))
            {
                dol_mkdir($dir);

                if (@is_dir($dir))
                {
                    $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
                    $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1);

                    if (! $result > 0)
                    {
                        $errors[] = "ErrorFailedToSaveFile";
                    }
                    else
                    {
                        // Create small thumbs for company (Ratio is near 16/9)
                        // Used on logon for example
                        $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);

                        // Create mini thumbs for company (Ratio is near 16/9)
                        // Used on menu or for setup page for example
                        $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
                    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:30,代码来源:soc.php

示例9: dolibarr_set_const

 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", $_POST["tel"], 'chaine', 0, '', $conf->entity);
 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", $_POST["fax"], 'chaine', 0, '', $conf->entity);
 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", $_POST["mail"], 'chaine', 0, '', $conf->entity);
 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", $_POST["web"], 'chaine', 0, '', $conf->entity);
 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", $_POST["note"], 'chaine', 0, '', $conf->entity);
 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", $_POST["barcode"], 'chaine', 0, '', $conf->entity);
 if ($_FILES["logo"]["tmp_name"]) {
     if (preg_match('/([^\\/:]+)$/i', $_FILES["logo"]["name"], $reg)) {
         $original_file = $reg[1];
         $isimage = image_format_supported($original_file);
         if ($isimage >= 0) {
             dol_syslog("Move file " . $_FILES["logo"]["tmp_name"] . " to " . $conf->mycompany->dir_output . '/logos/' . $original_file);
             if (!is_dir($conf->mycompany->dir_output . '/logos/')) {
                 dol_mkdir($conf->mycompany->dir_output . '/logos/');
             }
             $result = dol_move_uploaded_file($_FILES["logo"]["tmp_name"], $conf->mycompany->dir_output . '/logos/' . $original_file, 1, 0, $_FILES['logo']['error']);
             if ($result > 0) {
                 dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO", $original_file, 'chaine', 0, '', $conf->entity);
                 // Create thumbs of logo (Note that PDF use original file and not thumbs)
                 if ($isimage > 0) {
                     // Create small thumbs for company (Ratio is near 16/9)
                     // Used on logon for example
                     $imgThumbSmall = vignette($conf->mycompany->dir_output . '/logos/' . $original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
                     if (preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
                         $imgThumbSmall = $reg[1];
                         dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
                     } else {
                         dol_syslog($imgThumbSmall);
                     }
                     // Create mini thumbs for company (Ratio is near 16/9)
                     // Used on menu or for setup page for example
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:company.php

示例10: FormMail



/*
 * Add file in email form
 */
if ($_POST['addfile'] || $_POST['addfilehtml'])
{
	require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

	// Set tmp user directory
	$vardir=$conf->user->dir_output."/".$user->id;
	$upload_dir = $vardir.'/temp';

	if (create_exdir($upload_dir) >= 0)
	{
		$resupload=dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0,0,$_FILES['addedfile']['error']);
		if (is_numeric($resupload) && $resupload > 0)
		{
			$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';

			include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
			$formmail = new FormMail($db);
			$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
		}
		else
		{
			$langs->load("errors");
			if ($resupload < 0)	// Unknown error
			{
				$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
			}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:29,代码来源:mails.php

示例11: dol_add_file_process

/**
 * Get and save an upload file (for example after submitting a new file a mail form).
 * All information used are in db, conf, langs, user and _FILES.
 * @param	upload_dir				Directory to store upload files
 * @param	allowoverwrite			1=Allow overwrite existing file
 * @param	donotupdatesession		1=Do no edit _SESSION variable
 * @return	string					Message with result of upload and store.
 */
function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0)
{
	global $db,$user,$conf,$langs,$_FILES;

	$mesg='';

	if (! empty($_FILES['addedfile']['tmp_name']))
	{
		if (dol_mkdir($upload_dir) >= 0)
		{
			$resupload = dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],$allowoverwrite,0, $_FILES['addedfile']['error']);
			if (is_numeric($resupload) && $resupload > 0)
			{
				$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';

				if (empty($donotupdatesession))
				{
					include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
					$formmail = new FormMail($db);
					$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
				}
			}
			else
			{
				$langs->load("errors");
				if ($resupload < 0)	// Unknown error
				{
					$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
				}
				else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload))	// Files infected by a virus
				{
					$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
				}
				else	// Known error
				{
					$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
				}
			}
		}
	}
	else
	{
		$langs->load("errors");
		$mesg = '<div class="warning">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("File")).'</div>';
	}

	return $mesg;
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:56,代码来源:files.lib.php

示例12: get_exdir

 // Logo/Photo save
 $dir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 1, $object, 'member') . '/photos';
 $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
 if ($file_OK) {
     if (GETPOST('deletephoto')) {
         require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
         $fileimg = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 1, $object, 'member') . '/photos/' . $object->photo;
         $dirthumbs = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 1, $object, 'member') . '/photos/thumbs';
         dol_delete_file($fileimg);
         dol_delete_dir_recursive($dirthumbs);
     }
     if (image_format_supported($_FILES['photo']['name']) > 0) {
         dol_mkdir($dir);
         if (@is_dir($dir)) {
             $newfile = $dir . '/' . dol_sanitizeFileName($_FILES['photo']['name']);
             if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) {
                 setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
             } else {
                 // Create small thumbs for company (Ratio is near 16/9)
                 // Used on logon for example
                 $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
                 // Create mini thumbs for company (Ratio is near 16/9)
                 // Used on menu or for setup page for example
                 $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
             }
         }
     } else {
         setEventMessages("ErrorBadImageFormat", null, 'errors');
     }
 } else {
     switch ($_FILES['photo']['error']) {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:card.php

示例13: BonPrelevement

 * Actions
 */
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') {
    $bon = new BonPrelevement($db, "");
    $bon->id = $id;
    $bon->set_credite();
    Header("Location: fiche.php?id=" . $id);
    exit;
}
if ($action == 'infotrans' && $user->rights->prelevement->bons->send) {
    require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
    $bon = new BonPrelevement($db, "");
    $bon->fetch($id);
    if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'], ".ps") == $bon->ref) {
        $dir = $conf->prelevement->dir_output . '/receipts';
        if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 1) > 0) {
            $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
            $bon->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
        }
        Header("Location: fiche.php?id=" . $id);
        exit;
    } else {
        dol_syslog("Fichier invalide", LOG_WARNING);
        $mesg = 'BadFile';
    }
}
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) {
    $bon = new BonPrelevement($db, "");
    $bon->fetch($id);
    $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
    $error = $bon->set_infocredit($user, $dt);
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:fiche.php

示例14: add_photo

 /**
  *  Move an uploaded file described into $file array into target directory $sdir.
  *
  *  @param  string	$sdir       Target directory
  *  @param  string	$file       Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
  *  @return	int					<0 if KO, >0 if OK
  */
 function add_photo($sdir, $file)
 {
     global $conf;
     require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $result = 0;
     $dir = $sdir;
     if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
         $dir .= '/' . get_exdir($this->id, 2, 0, 0, $this, 'product') . $this->id . "/photos";
     } else {
         $dir .= '/' . dol_sanitizeFileName($this->ref);
     }
     dol_mkdir($dir);
     $dir_osencoded = $dir;
     if (is_dir($dir_osencoded)) {
         $originImage = $dir . '/' . $file['name'];
         // Cree fichier en taille origine
         $result = dol_move_uploaded_file($file['tmp_name'], $originImage, 1);
         if (file_exists(dol_osencode($originImage))) {
             // Cree fichier en taille vignette
             $this->add_thumb($originImage);
         }
     }
     if (is_numeric($result) && $result > 0) {
         return 1;
     } else {
         return -1;
     }
 }
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:35,代码来源:product.class.php

示例15: add_photo

 /**
  *    \brief      Deplace fichier uploade sous le nom $files dans le repertoire sdir
  *    \param      sdir        Repertoire destination finale
  *    \param      $file       Nom du fichier uploade
  *    \param      maxWidth    Largeur maximum que dois faire la miniature (160 par defaut)
  *    \param      maxHeight   Hauteur maximum que dois faire la miniature (120 par defaut)
  */
 function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
 {
     require_once DOL_DOCUMENT_ROOT . "/lib/files.lib.php";
     $dir = $sdir . '/' . get_exdir($this->id, 2) . $this->id . "/";
     $dir .= "photos/";
     if (!file_exists($dir)) {
         create_exdir($dir);
     }
     if (file_exists($dir)) {
         $originImage = $dir . $file['name'];
         // Cree fichier en taille origine
         $result = dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
         if (file_exists($originImage)) {
             // Cree fichier en taille vignette
             $this->add_thumb($originImage, $maxWidth, $maxHeight);
         }
     }
 }
开发者ID:netors,项目名称:dolibarr,代码行数:25,代码来源:categorie.class.php


注:本文中的dol_move_uploaded_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。