本文整理汇总了PHP中upload::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::upload方法的具体用法?PHP upload::upload怎么用?PHP upload::upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::upload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ppFile
/**
* Constructor
* @param string $varname Optional form variable name
*/
function ppFile($varname = 'uploadfile')
{
global $_PP_CONF, $_CONF;
$this->filenames = array();
$this->setContinueOnError(true);
$this->setLogFile('/tmp/warn.log');
$this->setDebug(true);
parent::upload();
// Before anything else, check the upload directory
if (!$this->setPath($_PP_CONF['download_path'])) {
return;
}
// For now, this is ok. Later maybe duplicate the $_PP_CONF array
// for downloaded mime-types. For some reason, upload.class.php and
// download.class.php have their array key=>values reversed.
$this->setAllowAnyMimeType(true);
//$this->setAllowedMimeTypes($_PP_CONF['allowedextensions']);
// Max size for uploads? This is only accessible to admins anyway.
$this->setMaxFileSize((int) $_PP_CONF['max_file_size'] * 1048576);
// Set the name of the form variable used.
$this->setFieldName($varname);
// For a single file this is a simple one-element array.
// To allow multiple files per product, a "real" array needs
// to be populated and another DB table will be needed.
//$filenames = array();
//for ($i = 0; $i < count($_FILES[$varname]['name']); $i++) {
// $this->filenames[] = $_FILES[$varname][$i]['name'];
//}
$this->filenames[] = $_FILES[$varname]['name'];
$this->setFileNames($this->filenames);
}
示例2: __construct
/**
* Constructor
* @param string $name Optional image filename
*/
public function __construct($ad_id, $varname = 'photo')
{
global $_CONF_ADVT, $_CONF;
if (empty($_FILES[$varname])) {
$this->havefiles = false;
return;
} else {
$this->havefiles = true;
}
$this->setContinueOnError(true);
$this->setLogFile($_CONF['path_log'] . 'error.log');
$this->setDebug(true);
parent::upload();
// Before anything else, check the upload directory
if (!$this->setPath(CLASSIFIEDS_IMGPATH)) {
return;
}
$this->ad_id = trim($ad_id);
$this->pathImage = CLASSIFIEDS_IMGPATH;
//$this->pathThumb = $this->pathImage . '/thumb'; // deprecated
$this->setAllowedMimeTypes(array('image/pjpeg' => '.jpg,.jpeg', 'image/jpeg' => '.jpg,.jpeg', 'image/png' => '.png'));
$this->setMaxFileSize($_CONF['max_image_size']);
$this->setMaxDimensions($_CONF_ADVT['img_max_width'], $_CONF_ADVT['img_max_height']);
$this->setAutomaticResize(true);
$this->setFieldName($varname);
$filenames = array();
for ($i = 0; $i < count($_FILES[$varname]['name']); $i++) {
$filenames[] = $this->ad_id . '_' . rand(100, 999) . '.jpg';
}
$this->setFileNames($filenames);
}
示例3: trim
/**
* Constructor
* @param string $name Optional image filename
*/
function __construct($product_id, $varname = 'photo')
{
global $_PP_CONF, $_CONF;
$this->setContinueOnError(true);
$this->setLogFile('/tmp/warn.log');
$this->setDebug(true);
parent::upload();
// Before anything else, check the upload directory
if (!$this->setPath($_PP_CONF['image_dir'])) {
return;
}
$this->product_id = trim($product_id);
$this->pathImage = $_PP_CONF['image_dir'];
$this->setAllowedMimeTypes(array('image/pjpeg' => '.jpg,.jpeg', 'image/jpeg' => '.jpg,.jpeg'));
$this->setMaxFileSize($_PP_CONF['max_image_size']);
$this->setMaxDimensions($_PP_CONF['img_max_width'], $_PP_CONF['img_max_height']);
$this->setAutomaticResize(true);
$this->setFieldName($varname);
$filenames = array();
for ($i = 0; $i < $this->numFiles(); $i++) {
$filenames[] = $this->product_id . '_' . rand(100, 999) . '.jpg';
}
$this->setFileNames($filenames);
}
示例4: elseif
}
tep_db_query("update " . TABLE_BOARDS_CATEGORIES . " set image = '' where boards_categories_id = '" . (int) $boards_categories_id . "'");
} else {
$uploaded = false;
if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
$size = @getimagesize($categories_image);
if ($size[2] == '3') {
$ext = '.png';
} elseif ($size[2] == '2') {
$ext = '.jpg';
} else {
$ext = '.gif';
}
$new_filename = $boards_categories_id . $ext;
$upload->filename = 'categories/' . $new_filename;
if ($upload->upload('image', DIR_FS_CATALOG_IMAGES)) {
if (CATEGORY_IMAGE_WIDTH > 0 || CATEGORY_IMAGE_HEIGHT > 0) {
tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', CATEGORY_IMAGE_WIDTH, CATEGORY_IMAGE_HEIGHT);
}
$prev_file_query = tep_db_query("select image from " . TABLE_BOARDS_CATEGORIES . " where boards_categories_id = '" . (int) $boards_categories_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['image']) && $prev_file['image'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_IMAGES . $prev_file['image']);
}
tep_db_query("update " . TABLE_BOARDS_CATEGORIES . " set image = '" . $upload->filename . "' where boards_categories_id = '" . (int) $boards_categories_id . "'");
}
}
}
tep_update_blocks($boards_categories_id, 'boards_category');
tep_redirect(tep_href_link(FILENAME_BOARDS, 'tPath=' . $tPath . '&cPath=' . $cPath . '&cID=' . $boards_categories_id));
}
示例5: explode
if ($imagesize) {
$size = explode(",", $imagesize);
if (count($size) % 2 != 0) {
$json = json_encode(array("state" => 'upload上传插件属性imagesize宽,高值必须成对出现如100,200,300,400'));
echo $json;
exit;
}
}
$dir = isset($_POST['dir']) ? $_POST['dir'] : '';
//上传目录
$thumb_type = isset($_POST['thumb_type']) ? $_POST['thumb_type'] : 6;
//缩略方式
C("THUMB_ON", 0);
C("WATER_ON", $water_on);
$upload = new upload($dir, '', $swfupload_size);
$uploadFile = $upload->upload();
$state = empty($upload->error) ? "SUCCESS" : $upload->error;
if (!$uploadFile) {
//上传失败
$json = json_encode(array("state" => $state));
echo $json;
exit;
}
$field = $uploadFile[0]['path'];
//上传成功文件物理路径
$info = pathinfo($field);
$fileData = array();
$fileData[0]['path'] = $field;
//上传后的大图
$fileData[0]['url'] = __ROOT__ . '/' . $field;
//上传后的大图URL
示例6: elseif
if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
$size = @getimagesize($manufacturers_image);
if ($size[2] == '3') {
$ext = '.png';
} elseif ($size[2] == '2') {
$ext = '.jpg';
} else {
$ext = '.gif';
}
$new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($manufacturers_path));
if (!tep_not_null($new_filename)) {
$new_filename = $manufacturers_id;
}
$new_filename .= $ext;
$upload->filename = 'manufacturers/' . $new_filename;
if ($upload->upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
if (MANUFACTURER_IMAGE_WIDTH > 0 || MANUFACTURER_IMAGE_HEIGHT > 0) {
tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', MANUFACTURER_IMAGE_WIDTH, MANUFACTURER_IMAGE_HEIGHT);
if (!is_dir(DIR_FS_CATALOG_IMAGES . 'manufacturers/thumbs')) {
mkdir(DIR_FS_CATALOG_IMAGES . 'manufacturers/thumbs', 0777);
}
tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, DIR_FS_CATALOG_IMAGES . str_replace('manufacturers/', 'manufacturers/thumbs/', $upload->filename), 50, 70);
}
$prev_file_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['manufacturers_image']) && $prev_file['manufacturers_image'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_IMAGES . $prev_file['manufacturers_image']);
}
tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $upload->filename . "' where manufacturers_id = '" . (int) $manufacturers_id . "'");
}
}
示例7: values
}
$category_name_1 = 'Книги на иностранных языках' . (tep_not_null($products_language) ? ' (' . $products_language . ')' : '');
$metatags_page_title = (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '.' : '') . (tep_not_null($category_name_1) ? ' ' . $category_name_1 . '.' : '') . ' Интернет-магазин Setbook.';
$metatags_title = $products_name;
$metatags_keywords = (tep_not_null($category_name_1) ? $category_name_1 . '. ' : '') . (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '. ' : ' ') . (tep_not_null($products_genre) ? $products_genre . '.' : '');
$metatags_description = (tep_not_null($category_name_1) ? $category_name_1 . '. ' : '') . (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '. ' : ' ') . (tep_not_null($products_description) ? preg_replace('/^([^\\.]+\\.).*$/', '$1', $products_description) : '');
$content_type = 'foreign';
$content_id = $products_id;
tep_db_query("replace into " . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) values ('" . tep_db_input($metatags_page_title) . "', '" . tep_db_input($metatags_title) . "', '" . tep_db_input($metatags_keywords) . "', '" . tep_db_input($metatags_description) . "', '" . (int) $languages_id . "', '" . tep_db_input($content_type) . "', '" . (int) $content_id . "')");
if ($upload = new upload('', '', '777', array('gif', 'jpeg', 'jpg', 'png'))) {
$new_filename = 'thumbs/' . substr(uniqid(rand()), 0, 10) . '.jpg';
$is_copied = false;
$products_image_url = tep_db_prepare_input($HTTP_POST_VARS['products_image_url']);
if (is_uploaded_file($products_image)) {
$upload->filename = $new_filename;
if ($upload->upload('products_image', DIR_FS_CATALOG_IMAGES . 'foreign/')) {
$is_copied = true;
}
} elseif (tep_not_null($products_image_url)) {
if (copy($products_image_url, DIR_FS_CATALOG_IMAGES . 'foreign/' . $new_filename)) {
$is_copied = true;
}
}
if ($is_copied) {
$prev_file_query = tep_db_query("select products_image from " . TABLE_FOREIGN_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['products_image'])) {
@unlink(DIR_FS_CATALOG_IMAGES . 'foreign/' . $prev_file['products_image']);
@unlink(DIR_FS_CATALOG_IMAGES . 'foreign/big/' . $prev_file['products_image']);
}
tep_create_thumb(DIR_FS_CATALOG_IMAGES . 'foreign/' . $new_filename, DIR_FS_CATALOG_IMAGES . 'foreign/big/' . $new_filename, BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT, '85', 'reduce_only');
示例8: array
$templates_description_array = $HTTP_POST_VARS['templates_description'];
$language_id = $languages[$i]['id'];
$sql_data_array = array('templates_name' => tep_db_prepare_input($templates_name_array[$language_id]), 'templates_description' => tep_db_prepare_input($templates_description_array[$language_id]), 'default_status' => $default_status, 'sort_order' => $sort_order);
if ($action == 'insert') {
$insert_sql_data = array('date_added' => 'now()', 'templates_id' => $templates_id, 'language_id' => $languages[$i]['id']);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_TEMPLATES, $sql_data_array);
} elseif ($action == 'update') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
tep_db_perform(TABLE_TEMPLATES, $sql_data_array, 'update', "templates_id = '" . (int) $templates_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
}
}
if ($upload = new upload('', '', '777', array('php'))) {
$upload->filename = 'template_' . $templates_id . '.html';
if ($upload->upload('templates_filename', DIR_FS_CATALOG_TEMPLATES)) {
$prev_file_query = tep_db_query("select templates_filename from " . TABLE_TEMPLATES . " where templates_id = '" . (int) $templates_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['templates_filename']) && $prev_file['templates_filename'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_TEMPLATES . $prev_file['templates_filename']);
}
tep_db_query("update " . TABLE_TEMPLATES . " set templates_filename = '" . tep_db_input($upload->filename) . "' where templates_id = '" . (int) $templates_id . "'");
} elseif (isset($HTTP_POST_VARS['templates_filename_contents'])) {
if (get_magic_quotes_gpc()) {
$templates_filename_contents = stripslashes(trim($HTTP_POST_VARS['templates_filename_contents']));
} else {
$templates_filename_contents = str_replace('\\"', '"', trim($HTTP_POST_VARS['templates_filename_contents']));
}
$prev_file_query = tep_db_query("select templates_filename from " . TABLE_TEMPLATES . " where templates_id = '" . (int) $templates_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['templates_filename'])) {
示例9: avatars
function avatars()
{
$db = M('user_info');
$db_info = $db->field('avatar')->where('uid=' . $_SESSION['uid'])->find();
$avatar = $db_info['avatar'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
C('UPLOAD_IMG_DIR', '');
//图片没有附文件夹
C('THUMB_ENDFIX', '');
//只生成头像缩略图(即覆盖原文件)
$upload = new upload(PATH_ROOT . '/uploads/avatars', array('jpg', 'jpeg', 'png', 'gif'), 3145728, 0, 1, array(100, 100, 4));
$info = $upload->upload();
if ($info) {
$db->where('uid=' . $_SESSION['uid'])->update(array('avatar' => $info[0]['thumb']));
unlink(PATH_ROOT . '/' . $avatar);
//删除之前的头像文件
$this->success('头像修改成功', 'avatars');
} else {
$this->error($upload->error);
}
}
$this->assign('avatar', $avatar);
$this->display('profile/avatars');
}
示例10: links
function links()
{
$db = V('link');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$_POST['created'] = time();
if ($_FILES['logo']['error'] == 0) {
C('UPLOAD_IMG_DIR', '');
$upload = new upload('uploads/link', array('jpg', 'png', 'gif'), 2465792);
$up_info = $upload->upload();
if ($up_info) {
$_POST['logo'] = $up_info[0]['path'];
}
}
if ($db->table('link')->insert($_POST)) {
$this->success('添加友情链接成功!');
}
}
$db->view = array('link_category' => array('type' => 'INNER', 'on' => 'link.cate_id=link_category.lcid'));
$links = $db->findall();
$cates = $db->table('link_category')->join(NULL)->findall();
$this->assign('cates', $cates);
$this->assign('links', $links);
$this->display();
}
示例11: while
$shops_query = tep_db_query("select shops_database from " . TABLE_SHOPS . " where shops_database <> ''" . ($action == 'update_block' ? " and shops_id = '" . (int) SHOP_ID . "'" : ""));
while ($shops = tep_db_fetch_array($shops_query)) {
tep_db_select_db($shops['shops_database']);
if ($action == 'insert_block') {
tep_db_perform(TABLE_BLOCKS, $sql_data_array);
} elseif ($action == 'update_block') {
tep_db_perform(TABLE_BLOCKS, $sql_data_array, 'update', "blocks_id = '" . (int) $blocks_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
}
}
tep_db_select_db(DB_DATABASE);
}
$sql = "";
if (DEBUG_MODE == 'on') {
if ($upload = new upload('', '', '777', array('php'))) {
$upload->filename = 'block_' . $blocks_id . '.php';
if ($upload->upload('blocks_filename', DIR_FS_CATALOG_BLOCKS)) {
$prev_file_query = tep_db_query("select blocks_filename from " . TABLE_BLOCKS . " where blocks_id = '" . (int) $blocks_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['blocks_filename']) && $prev_file['blocks_filename'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_BLOCKS . $prev_file['blocks_filename']);
}
$sql .= "update " . TABLE_BLOCKS . " set blocks_filename = '" . tep_db_input($upload->filename) . "' where blocks_id = '" . (int) $blocks_id . "';\n";
} elseif (isset($HTTP_POST_VARS['blocks_filename_contents'])) {
$blocks_filename_contents = stripslashes($HTTP_POST_VARS['blocks_filename_contents']);
$prev_file_query = tep_db_query("select blocks_filename from " . TABLE_BLOCKS . " where blocks_id = '" . (int) $blocks_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['blocks_filename'])) {
@unlink(DIR_FS_CATALOG_BLOCKS . $prev_file['blocks_filename']);
} else {
$prev_file['blocks_filename'] = 'block_' . $blocks_id . '.php';
}
示例12: upload
$banners_image_target = tep_db_prepare_input($HTTP_POST_VARS['banners_image_target']);
$db_image_location = '';
$expires_date = tep_db_prepare_input($HTTP_POST_VARS['expires_date']);
$expires_impressions = tep_db_prepare_input($HTTP_POST_VARS['expires_impressions']);
$date_scheduled = tep_db_prepare_input($HTTP_POST_VARS['date_scheduled']);
$banners_weight = tep_db_prepare_input($HTTP_POST_VARS['banners_weight']);
$banners_use_group_conditions = tep_db_prepare_input($HTTP_POST_VARS['banners_use_group_conditions']);
$banner_error = false;
if (empty($banners_title)) {
$messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
$banner_error = true;
}
if (empty($banners_html_text)) {
if (empty($banners_image_local)) {
$banners_image = new upload();
if ($banners_image->upload('banners_image', DIR_FS_CATALOG_IMAGES . 'banners/' . $banners_image_target)) {
} else {
$banner_error = true;
}
}
}
if ($banner_error == false) {
$db_image_location = 'banners/' . (tep_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename);
$sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_groups_id' => $gPath, 'banners_weight' => $banners_weight, 'banners_use_group_conditions' => $banners_use_group_conditions, 'banners_html_text' => $banners_html_text);
if ($action == 'insert') {
$insert_sql_data = array('date_added' => 'now()', 'status' => '1');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_BANNERS, $sql_data_array);
$banners_id = tep_db_insert_id();
$messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
} elseif ($action == 'update') {
示例13: elseif
if (tep_not_null($image_type)) {
if ($image_type == '1') {
$ext = 'gif';
} elseif ($image_type == '2') {
$ext = 'jpg';
} elseif ($image_type == '3') {
$ext = 'png';
}
} else {
$ext = 'jpg';
}
$upload->filename = 'thumbs/p' . $products_id . '.' . $ext;
}
$uploaded = false;
if (is_uploaded_file($products_image_big)) {
if ($upload->upload('products_image_big', DIR_FS_CATALOG_IMAGES_BIG)) {
$uploaded = true;
tep_create_thumb(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename, '', BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT);
}
} elseif ($HTTP_POST_VARS['delete_big'] == '1') {
@unlink(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename);
}
if (is_uploaded_file($products_image_middle)) {
if ($upload->upload('products_image_middle', DIR_FS_CATALOG_IMAGES_MIDDLE)) {
$uploaded = true;
tep_create_thumb(DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename, '', BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT);
}
} elseif ($HTTP_POST_VARS['delete_middle'] == '1') {
@unlink(DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename);
} elseif ($HTTP_POST_VARS['middle_from_big'] == '1') {
tep_create_thumb(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename, DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename, MIDDLE_IMAGE_WIDTH, MIDDLE_IMAGE_HEIGHT);
示例14: elseif
if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
$size = @getimagesize($series_image);
if ($size[2] == '3') {
$ext = '.png';
} elseif ($size[2] == '2') {
$ext = '.jpg';
} else {
$ext = '.gif';
}
$new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($series_path));
if (!tep_not_null($new_filename)) {
$new_filename = $series_id;
}
$new_filename .= $ext;
$upload->filename = 'series/' . $new_filename;
if ($upload->upload('series_image', DIR_FS_CATALOG_IMAGES)) {
$prev_file_query = tep_db_query("select series_image from " . TABLE_SERIES . " where series_id = '" . (int) $series_id . "'");
$prev_file = tep_db_fetch_array($prev_file_query);
if (tep_not_null($prev_file['series_image']) && $prev_file['series_image'] != $upload->filename) {
@unlink(DIR_FS_CATALOG_IMAGES . $prev_file['series_image']);
}
if (SERIE_IMAGE_WIDTH > 0 || SERIE_IMAGE_HEIGHT > 0) {
tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', SERIE_IMAGE_WIDTH, SERIE_IMAGE_HEIGHT);
}
tep_db_query("update " . TABLE_SERIES . " set series_image = '" . $upload->filename . "' where series_id = '" . (int) $series_id . "'");
}
}
tep_update_blocks($series_id, 'serie');
tep_redirect(tep_href_link(FILENAME_SERIES, 'search=' . urlencode($search) . '&page=' . $HTTP_GET_VARS['page'] . '&sID=' . $series_id));
break;
case 'deleteconfirm':
示例15: delete_files
$GMT_time = time();
$insert_mesg_query = "INSERT INTO frei_chat (frei_chat.\"from\",from_name,frei_chat.\"to\",to_name,message,frei_chat.\"sent\",frei_chat.\"time\",message_type,room_id,GMT_time) VALUES(?,?,?,?,?,?,?,?,?,?)";
$this->insert_mesg_query = $this->db->prepare($insert_mesg_query);
$this->insert_mesg_query->execute(array($this->frm_id, $this->usr_name, $this->to, $this->to_name, $message, $this->mysql_now, $time, 0, '-1', $GMT_time));
//echo $query;
}
//---------------------------------------------------------------------------------------------
public function delete_files()
{
$captchaFolder = $this->path;
// Filetypes to check (you can also use *.*)
$fileTypes = '*.*';
$expire_time = $this->expirytime;
//in minutes
// Find all files of the given file type
foreach (glob($captchaFolder . $fileTypes) as $Filename) {
// Read file creation time
$FileCreationTime = filectime($Filename);
// Calculate file age in seconds
$FileAge = time() - $FileCreationTime;
// Is the file older than the given time span?
if ($FileAge > $expire_time * 60) {
// echo "The file $Filename is older than $expire_time minutes\n";
unlink($Filename);
}
}
}
}
$upload = new upload();
$upload->upload();