本文整理汇总了PHP中upload_article_file函数的典型用法代码示例。如果您正苦于以下问题:PHP upload_article_file函数的具体用法?PHP upload_article_file怎么用?PHP upload_article_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upload_article_file函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sys_msg
$is_only = $exc->is_only('title', $_POST['title'], $_POST['id'], "cat_id = '{$_POST['article_cat']}'");
if (!$is_only) {
sys_msg(sprintf($_LANG['title_exist'], stripslashes($_POST['title'])), 1);
}
if (empty($_POST['cat_id'])) {
$_POST['cat_id'] = 0;
}
/* 取得文件地址 */
$file_url = '';
if (empty($_FILES['file']['error']) || !isset($_FILES['file']['error']) && isset($_FILES['file']['tmp_name']) && $_FILES['file']['tmp_name'] != 'none') {
// 检查文件格式
if (!check_file_type($_FILES['file']['tmp_name'], $_FILES['file']['name'], $allow_file_types)) {
sys_msg($_LANG['invalid_file']);
}
// 复制文件
$res = upload_article_file($_FILES['file']);
if ($res != false) {
$file_url = $res;
}
}
if ($file_url == '') {
$file_url = $_POST['file_url'];
}
/* 计算文章打开方式 */
if ($file_url == '') {
$open_type = 0;
} else {
$open_type = $_POST['FCKeditor1'] == '' ? 1 : 2;
}
/* 如果 file_url 跟以前不一样,且原来的文件是本地文件,删除原来的文件 */
$sql = "SELECT file_url FROM " . $ecs->table('article') . " WHERE article_id = '{$_POST['id']}'";
示例2: addNews
function addNews()
{
$file_url = '';
if (isset($_FILES['file']['error']) && $_FILES['file']['error'] == 0 || !isset($_FILES['file']['error']) && isset($_FILES['file']['tmp_name']) && $_FILES['file']['tmp_name'] != 'none') {
if (!check_file_type($_FILES['file']['tmp_name'], $_FILES['file']['name'], $allow_file_types)) {
sys_msg($_LANG['invalid_file']);
}
$res = upload_article_file($_FILES['file']);
if ($res != false) {
$file_url = $res;
}
}
if (!$file_url && $_POST['article_id']) {
$file_url = $_POST['file_url'];
}
$open_type = 2;
/*插入数据*/
$add_time = gmtime();
$_POST['cat_id'] = 0;
if (!$_POST['article_id']) {
$sql = "INSERT INTO " . $GLOBALS['ecs']->table('article') . "(title, cat_id, article_type, is_open, author, " . "author_email, keywords, content, add_time, file_url, open_type, link, description) " . "VALUES ('{$_POST['title']}', '{$_POST['article_cat']}', '0', '1', " . "'', '', '', '{$_POST['description']}', " . "'{$add_time}', '{$file_url}', '{$open_type}', '{$_POST['link_url']}', '{$_POST['description']}')";
$GLOBALS['db']->query($sql);
return $GLOBALS['db']->insert_id();
} else {
$aid = (int) $_POST['article_id'];
$GLOBALS['db']->query("update " . $GLOBALS['ecs']->table('article') . " set \r\n\t\ttitle='{$_POST[title]}',file_url='{$file_url}',link='{$_POST['link_url']}',description='{$_POST['description']}' where article_id={$aid}");
return $aid;
}
}
示例3: save_notice_attach
/**
* 保存附件
* Enter description here ...
* @param unknown_type $attach
*/
function save_notice_attach($notice_id, $attach, $uploader)
{
global $allow_file_types;
$result = array("error" => 0, "msg" => "");
if (isset($attach['error']) && $attach['error'] == 0 || !isset($attach['error']) && isset($attach['tmp_name']) && $attach['tmp_name'] != 'none') {
// 检查文件格式
if (!check_file_type($attach['tmp_name'], $attach['name'], $allow_file_types)) {
return array("error" => 1, "msg" => "您上传的文件格式不被允许,只能是以下格式的文件才能上传:" . $allow_file_types);
}
// 复制文件
$res = upload_article_file($attach);
if ($res != false) {
$file_url = $res;
}
} else {
if (isset($attach['error']) && $attach['error'] == 4) {
return $result;
} else {
return array("error" => 1, "msg" => "您上传的文件存在异常,文件必须在2M之内,且只能是以下格式的文件:" . $allow_file_types);
}
}
$sql = "insert into " . $GLOBALS['ecs']->table("notice_attach") . " (notice_id, name, path, size, type, uploader, created) \r\n\t\tvalues ('{$notice_id}', '{$attach['name']}', '{$file_url}', '{$attach['size']}', '{$attach['type']}', '{$uploader}', now()) ";
$GLOBALS['db']->query($sql);
return $result;
}
示例4: upload_article_file
if ($res8 != false) {
$file_url8 = $res8;
}
} else {
$file_url8 = $_POST['jg_tou_url'];
}
if (isset($_FILES['left_img']['error']) && $_FILES['left_img']['error'] == 0 || !isset($_FILES['left_img']['error']) && isset($_FILES['left_img']['tmp_name']) && $_FILES['left_img']['tmp_name'] != 'none') {
$res9 = upload_article_file($_FILES['left_img']);
if ($res9 != false) {
$file_url9 = $res9;
}
} else {
$file_url9 = $_POST['left_img_url'];
}
if (isset($_FILES['rec_img']['error']) && $_FILES['rec_img']['error'] == 0 || !isset($_FILES['rec_img']['error']) && isset($_FILES['rec_img']['tmp_name']) && $_FILES['rec_img']['tmp_name'] != 'none') {
$res10 = upload_article_file($_FILES['rec_img']);
if ($res10 != false) {
$file_url10 = $res10;
}
} else {
$file_url10 = $_POST['rec_img'];
}
if ($exc2->edit("jg_name = '{$_POST['jg_name']}',is_open ='{$_POST['is_open']}', jg_img = '{$file_url6}', jg_tou = '{$file_url8}', jg_name_img = '{$file_url7}', jg_brief = '{$_POST['jg_brief']}',jg_company = '{$_POST['jg_company']}', jg_guoji = '{$_POST['jg_guoji']}', jg_area = '{$_POST['jg_area']}', jg_products1 = '{$file_url1}', jg_products2 = '{$file_url2}', jg_products3 = '{$file_url3}', jg_products4 = '{$file_url4}', jg_products5 = '{$file_url5}',jg_answer1 = '{$_POST['jg_answer1']}',jg_answer2 = '{$_POST['jg_answer2']}',jg_answer3 = '{$_POST['jg_answer3']}',jg_answer4 = '{$_POST['jg_answer4']}',jg_ask1 = '{$_POST['jg_ask1']}',jg_ask2 = '{$_POST['jg_ask2']}',jg_ask3 = '{$_POST['jg_ask3']}',jg_ask4 = '{$_POST['jg_ask4']}',experience = '{$_POST['experience']}',zuoyouming='{$_POST['zuoyouming']}',rec_img = '{$file_url10}',left_img = '{$file_url9}'", $_POST['id'])) {
$link[0]['text'] = $_LANG['back_list'];
$link[0]['href'] = 'article.php?act=jg_list&' . list_link_postfix();
$note = sprintf($_LANG['articleedit_succeed'], stripslashes($_POST['title']));
admin_log($_POST['title'], 'edit', 'article');
clear_cache_files();
sys_msg($note, 0, $link);
} else {
die($db->error());
示例5: array
$file_arr = array();
$arr = $_FILES['attr_img_list'];
$file_num = count($arr['name']);
//进行图片信息分组
for ($i = 0; $i < $file_num; $i++) {
$file_arr[$i]['name'] = $arr['name'][$i];
$file_arr[$i]['type'] = $arr['type'][$i];
$file_arr[$i]['tmp_name'] = $arr['tmp_name'][$i];
$file_arr[$i]['error'] = $arr['error'][$i];
$file_arr[$i]['size'] = $arr['size'][$i];
}
//上传属性图片并获取上传后的图片路径
$url_arr = array();
for ($i = 0; $i < $file_num; $i++) {
if (isset($file_arr[$i]['error']) && $file_arr[$i]['error'] == 0 || !isset($file_arr[$i]['error']) && isset($file_arr[$i]['tmp_name']) && $file_arr[$i]['tmp_name'] != 'none') {
$res = upload_article_file($file_arr[$i]);
if ($res != false) {
$url_arr[$i] = $res;
}
} else {
$url_arr[$i] = '';
}
}
/* 插入还是更新的标识 */
$is_insert = $_REQUEST['act'] == 'insert';
/* 处理商品图片 */
$goods_img = '';
// 初始化商品图片
$goods_thumb = '';
// 初始化商品缩略图
$original_img = '';