$ajax = new etamineAjax(); $ajax->showLoading(); $ajax->setRequestType("POST"); // Change request-type from GET to POST $ajax->exportFunction("fileremove"); $ajax->process(); function fileremove($fileid,$filelocation) { $tab = new etamineAjaxBehavior(); //remove the file information from the session array $fileArray = $_SESSION['filename']; for ($i = 1; $i <= count($fileArray); $i++) { if ($fileArray[$i]['FILEID'] <> $fileid) { $j++; $newFileArray[$j] = $fileArray[$i]; } } $_SESSION['filename'] = $newFileArray; unlink(USERFILES . "tmp/" . $filelocation); $tab->add(TabRedirect::getBehavior("?module=helpdeskpublic&action=fileupload&nomenu=1")); return $tab->getString(); } if (isset($_FILES['file'])) { // file was send from browser if ($_FILES['file']['error'] == UPLOAD_ERR_OK) { // no error $filename = $_FILES['file']['name']; // file name $filetype = $_FILES['file']['type']; // file type $filesize = $_FILES['file']['size']; // file size $allFiles = $_SESSION['filename']; $filecount = count($allFiles); $filecount = $filecount + 1; $filenamesaved = session_id() . "_" . $filecount . "_" . $filename; $allFiles[$filecount] = array( //$allFiles[$filecount] = "FILEID"=>$filecount, "FILENAME"=>$filename, "FILETYPE"=>$filetype, "FILESIZE"=>$filesize, "FILENAMESAVED"=>$filenamesaved, "IMAGEPATH"=> USERFILES . "tmp" . '/' .$filenamesaved, ); move_uploaded_file($_FILES['file']['tmp_name'], USERFILES . "tmp" . '/' .$filenamesaved); // main action -- move uploaded file to $upload_dir $result = 'OK'; $_SESSION['filename'] = $allFiles; } elseif ($_FILES['file']['error'] == UPLOAD_ERR_INI_SIZE) $result_msg = 'The uploaded file exceeds the maximum file size to upload'; else $result_msg = 'Unknown error'; } //Show the file information in the session //$middleValues[] = $attachmentArray; $middleValues[] = array( "AJAXCONTENT" => $ajax->getJavaScript(false, true), "STARTNO" => 1, "GROUPID" => $_SESSION['GROUPID'], "FORMACTION" => $p_action, "MODULE" => $p_module, "PAGECONTENTS" => $pageContents, "JSDIR" => $GLOBALS['javascript'], "SKINS" => $GLOBALS['skins'], "TEAMTYPEOPTION" => $teamtypeOption, "ERRORMSG" => $result_msg, "USERFILES" => USERFILES . "tmp/", ); $etamineParser->assign("filevalues",$_SESSION['filename']); $middleContents = $etamineParser->Parse($GLOBALS['template'] . "helpdeskpublic/fileupload.html",$middleValues); ?>