本文整理汇总了PHP中dol_add_file_process函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_add_file_process函数的具体用法?PHP dol_add_file_process怎么用?PHP dol_add_file_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_add_file_process函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dol_add_file_process
/**
* \file htdocs/core/actions_sendmails.inc.php
* \brief Code for actions on sending mails from object page
*/
// TODO Include this include file into all class objects
// $id must be defined
// $actiontypecode must be defined
/*
* Add file in email form
*/
if (GETPOST('addfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory
$vardir = $conf->user->dir_output . "/" . $user->id;
$upload_dir_tmp = $vardir . '/temp';
dol_add_file_process($upload_dir_tmp, 0, 0);
$action = 'presend';
}
/*
* Remove file in email form
*/
if (!empty($_POST['removedfile'])) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp user directory
$vardir = $conf->user->dir_output . "/" . $user->id;
$upload_dir_tmp = $vardir . '/temp';
// TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'], 0);
$action = 'presend';
}
/*
示例2: Locataire
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "name";
}
$object = new Locataire($db);
$object->fetch($id);
$upload_dir = $conf->immobilier->dir_output . '/locataire/' . dol_sanitizeFileName($object->id);
$modulepart = 'immobilier';
/*
* Actions
*/
if (GETPOST("sendit") && !empty($conf->global->MAIN_UPLOAD_DOC)) {
dol_add_file_process($upload_dir, 0, 1, 'userfile');
}
if ($action == 'delete') {
$file = $upload_dir . '/' . GETPOST("urlfile");
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret = dol_delete_file($file);
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
}
}
/*
* View
*/
llxheader('', $langs->trans("adddocument"), '');
示例3: dol_add_file_process
* or see http://www.gnu.org/
*/
// Variable $upload_dir must be defined when entering here
// Send file/link
if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
dol_add_file_process($upload_dir, 0, 1, 'userfile');
}
} elseif (GETPOST('linkit') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
$link = GETPOST('link', 'alpha');
if ($link) {
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
$link = 'http://' . $link;
}
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link);
}
}
}
// Delete file/link
if ($action == 'confirm_deletefile' && $confirm == 'yes') {
if ($object->id) {
$urlfile = GETPOST('urlfile', 'alpha');
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if (GETPOST('section')) {
$file = $upload_dir . "/" . $urlfile;
} else {
$urlfile = basename($urlfile);
$file = $upload_dir . "/" . $urlfile;
}
$linkid = GETPOST('linkid', 'int');
示例4: Header
Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit;
}
$mesg = $object->error;
}
$mesg = '<div class="error">' . $mesg . '</div>';
$action = "";
}
/*
* Add file in email form
*/
if (!empty($_POST['addfile'])) {
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1);
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
// Set tmp user directory
$mesg = dol_add_file_process($upload_dir, 0, 0);
$action = "edit";
}
// Action remove file
if (!empty($_POST["removedfile"])) {
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id, 2, 0, 1);
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$mesg = dol_remove_file_process($_POST['removedfile'], 0);
$action = "edit";
}
// Action update emailing
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"])) {
require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$isupload = 0;
if (!$isupload) {
$object->sujet = trim($_POST["sujet"]);