isLogged ()) throw new Exception (__ ('Attention! Probably attack detected. Access Denied!')); if (!isset ($_GET['fieldId'])) throw new Exception ('There was lost of variables!'); $idFieldFile = $_GET['fieldId']; ob_start (); ?>
beginTransaction (); if ($fileType == 'application/save' && !($fileType = $archive->getMimeByExtension (array_pop (explode ('.', $file ['name']))))) throw new Exception (__ ('This type of file is not accepted by the system !')); if (!$archive->isAcceptable ($fileType)) throw new Exception (__ ('This type of file is not accepted by the system ( [1] ) !', $fileType)); $uploadFilter = array (); if (trim ($_POST['upload_filter']) != '') $uploadFilter = explode (',', $_POST['upload_filter']); if (sizeof ($uploadFilter) && !in_array ($fileType, $uploadFilter)) throw new Exception (__ ('This type of file is not accept at this field! Files accepts are : [1]', implode (', ', $uploadFilter))); $fileId = Database::nextId ('_file', '_id'); $sth = $db->prepare ("INSERT INTO _file (_id, _name, _mimetype, _size, _description, _user) VALUES (:id, :name, :type, :size, :description, :user)"); $sth->bindParam (':id', $fileId, PDO::PARAM_INT); $sth->bindParam (':name', $fileName, PDO::PARAM_STR); $sth->bindParam (':type', $fileType, PDO::PARAM_STR); $sth->bindParam (':size', $fileSize, PDO::PARAM_INT); $sth->bindParam (':description', $fileDesc, PDO::PARAM_STR); $sth->bindParam (':user', User::singleton ()->getId (), PDO::PARAM_INT); $sth->execute (); if (move_uploaded_file ($fileTemp, File::getFilePath ($fileId))) { Lucene::singleton ()->saveFile ($fileId); ?> getDataPath ())); $db->commit (); } catch (PDOException $e) { $db->rollBack (); $error = $e->getMessage (); } catch (Exception $e) { $db->rollBack (); $error = $e->getMessage (); } } ?>