function submitUploadForm() { global $errors, $menu; $isWysiwyg = @$_REQUEST['wysiwygForm']; // if ($isWysiwyg) { disableInDemoMode('', 'default/wysiwygUploads.php', false); } else { disableInDemoMode('', 'default/uploadForm.php', false); } // remove uploads without record numbers that are older than 1 day removeExpiredUploads(); ### process uploads $errors = ''; $newUploadNums = array(); foreach (array_values($_FILES) as $uploadInfo) { $errors .= saveUpload($GLOBALS['tableName'], $_REQUEST['fieldName'], @$_REQUEST['num'], @$_REQUEST['preSaveTempId'], $uploadInfo, $newUploadNums); } ### Error checking if (!$newUploadNums && !$errors) { $errors = t("Please select a file to upload.") . "\n"; } ### display errors - errors will automatically be displayed when page is refreshed if ($errors) { return; } ### On Successful Save $isDetailFields = getUploadInfoFields($_REQUEST['fieldName']); if ($isWysiwyg) { // $errors = "File Uploaded"; } elseif ($isDetailFields) { // redirect to modify upload details page $newUploadNumsAsCSV = join(',', $newUploadNums); $modifyUrl = "?menu={$menu}" . "&action=uploadModify" . "&fieldName=" . @$_REQUEST['fieldName'] . "&num=" . @$_REQUEST['num'] . "&preSaveTempId=" . @$_REQUEST['preSaveTempId'] . "&uploadNums={$newUploadNumsAsCSV}"; print "<script type='text/javascript'>self.parent.reloadIframe('" . @$_REQUEST['fieldName'] . "_iframe')</script>"; // reload uploadlist print "<script type='text/javascript'>window.location='{$modifyUrl}'</script>"; // go to modify page exit; } else { // reload parent iframe (with upload list) print "<script type='text/javascript'>self.parent.reloadIframe('" . @$_REQUEST['fieldName'] . "_iframe')</script>"; // reload uploadlist print "<script type='text/javascript'>self.parent.tb_remove();</script>\n"; // close thickbox exit; } }
/** * @version $Id: registration.php,v 1.19 2004/09/22 00:12:41 prazgod Exp $ * @package Mambo_4.5.1 * @copyright (C) 2000 - 2004 Miro International Pty Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * Mambo is Free Software */ /** ensure this file is being included by a parent file */ defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); $task = mosGetParam($_REQUEST, 'task', ""); require_once $mainframe->getPath('front_html'); //print "<script> alert($mosConfig_live_site . '/components/com_user_extended/user_extended_content.html.php');</script>\n"; //include($mosConfig_live_site . '/components/com_user_extended/user_extended_content.html.php'); switch ($task) { case "saveUpload": saveUpload($mosConfig_dbprefix, $uid, $option, $userfile, $userfile_name, $type, $existingImage); break; case "UserDetails": userEdit($option, $my->id, _UPDATE); break; case "saveUserEdit": userSave($option, $my->id); break; case "UserView": UserView($option, $my->id); break; case "CheckIn": CheckIn($my->id, $access, $option); break; // standard options 4.5.1 // standard options 4.5.1
function saveUploadFromFilepath($tablename, $fieldname, $recordNum, $preSaveTempId, $filepath) { // copy local file $tmpFilepath = tempnam(DATA_DIR, 'temp_upload_'); copy($filepath, $tmpFilepath); register_shutdown_function('error_reporting', E_ALL ^ E_WARNING); // hide warnings (if file already removed) register_shutdown_function('unlink', $tmpFilepath); // remove temp file on shutdown (do this now so we don't leave an orphan file if we die() with an error // fake uploadInfo (like $_FILE would have contained) $fakeUploadInfo = array('name' => basename($filepath), 'tmp_name' => $tmpFilepath, 'error' => '', 'size' => 1); $errors = saveUpload($tablename, $fieldname, $recordNum, $preSaveTempId, $fakeUploadInfo, $newUploadNums, true); // return $errors; }