本文整理汇总了PHP中uploadfile函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadfile函数的具体用法?PHP uploadfile怎么用?PHP uploadfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uploadfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
$target = $INI['system']['imgprefix']."/static/team/{$year}/{$day}/{$fname}";
if($immediate=='1')$target='!'.$target;
if($msgtype==1)$msg=$target;
else $msg=array('url'=>$target,'localname'=>$upfile['name'],'id'=>'1');//id参数固定不变,仅供演示,实际项目中可以是数据库ID
}
}
else $err='上传文件扩展名必需为:'.$upext;
if (is_resource($upfile['tmp_name'])) {fclose($upfile['tmp_name']);}
else { @unlink($upfile['tmp_name']); }
}
return array('err'=>$err,'msg'=>$msg);
}
//HTML5 上传
if(isset($_SERVER['HTTP_CONTENT_DISPOSITION'])) {
if(preg_match('/attachment;\s+name="(.+?)";\s+filename="(.+?)"/i',$_SERVER['HTTP_CONTENT_DISPOSITION'],$info)) {
$temp_name = tmpfile();
$content = file_get_contents("php://input");
fwrite($temp_name, $content);
fseek($temp_name, 0);
$size = strlen($content);
$_FILES[$info[1]]=array('name'=>$info[2],'tmp_name'=>$temp_name,'size'=>$size,'type'=> '','error'=>0);
}
}
//End HTML5
$state=uploadfile('filedata');
echo json_encode($state);
示例2: _Header
}
_Header();
}
foreach ($_POST['name'] as $id => $value) {
$DreamCMS->db->query("update `#DC@__links` set `name`='{$value}',`url`='" . $_POST['url'][$id] . "',`desc`='" . $_POST['description'][$id] . "',`orderid`='" . $_POST['displayorder'][$id] . "' where `id`='{$id}'");
}
_Header();
}
if ($action == 'add') {
$id = intval($id);
$name = $_POST['name'] ? save($_POST['name']) : '';
$url = $_POST['url'] ? save($_POST['url']) : '';
$desc = $_POST['description'] ? save($_POST['description']) : '';
//$logo = $_POST['logo'];
$orderid = intval($_POST['displayorder']);
empty($name) && alert('网站名称不能为空!');
empty($url) && alert('网站URL不能为空!');
strpos($url, 'http://') === false && ($url = 'http://' . $url);
$artlogo = $_POST['artlogo'] ? save($_POST['artlogo']) : '';
$_logo = uploadfile("logo", $name);
$logo = empty($_logo) ? $artlogo : $_logo['FilePath'];
//$DreamCMS->db->query("INSERT INTO `#DC@__links` (`name`,`logo`,`desc`,`url`,`orderid`) VALUES ('$name','$logo','$desc','$url','$orderid')");
if ($id) {
$DreamCMS->db->query("UPDATE `#DC@__links` SET `name`='{$name}',`logo`='{$logo}',`desc`='{$desc}',`url`='{$url}',`orderid`='{$orderid}' WHERE `id`='{$id}' LIMIT 1");
} else {
$DreamCMS->db->query("INSERT INTO `#DC@__links` (`name`,`logo`,`desc`,`url`,`orderid`) VALUES ('{$name}','{$logo}','{$desc}','{$url}','{$orderid}')");
}
_Header("admincp.php?do=link");
}
break;
}
示例3: register
register();
} else {
if ($ask == "edituser") {
edituser();
} else {
if ($ask == "changepsd") {
changepsd();
} else {
if ($ask == "delete") {
del();
} else {
if ($ask == "image") {
uploadimage();
} else {
if ($ask == "file") {
uploadfile();
} else {
if ($ask == "lzl") {
lzl();
} else {
if ($ask == "search") {
search();
} else {
if ($ask == "action") {
action();
} else {
echo '<capu><info><code>14</code><msg>ask错误。</msg></info></capu>';
exit;
}
}
}
示例4: pkpost
//.........这里部分代码省略.........
}
}
} elseif ($_G['myshopstatus'] == 'unverified') {
$setsqlarr['grade'] = 0;
}
$setsqlarr['dateline'] = $_G['timestamp'];
$setsqlarr['uid'] = $_G['uid'];
$setsqlarr['username'] = $_G['username'];
$setsqlarr['lastpost'] = $setsqlarr['dateline'];
// 標題圖片處理 Start
if (!empty($modelsinfoarr['thumbsize'])) {
$modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize']));
$modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0];
$modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1];
}
if ($_POST['imagetype'] == 0 && $modelsinfoarr['modelname'] == 'consume' && $_G['setting']['allowcreateimg']) {
if ($_GET['action'] == 'add') {
$hotline = $_SGLOBAL['panelinfo']['tel'];
$address = $_SGLOBAL['panelinfo']['address'];
} else {
$shopinfo = DB::fetch(DB::query("SELECT tel, address FROM " . tname('shopitems') . " WHERE itemid='{$setsqlarr['shopid']}'"));
$hotline = $shopinfo['tel'];
$address = $shopinfo['address'];
}
$dealer_name = DB::result_first("SELECT subject FROM " . tname('shopitems') . " WHERE itemid='{$setsqlarr['shopid']}'");
$createimgarr = array('id' => intval($_POST['imgtplid']), 'mid' => intval($modelsinfoarr['mid']), 'itemid' => intval($itemid), 'coupon_title' => $setsqlarr['subject'], 'dealer_id' => $setsqlarr['uid'], 'dealer_name' => $dealer_name, 'begin_date' => date('Y-m-d', $setsqlarr['validity_start']), 'end_date' => date('Y-m-d', $setsqlarr['validity_end']), 'brief' => trim($_POST['message']), 'exception' => trim($_POST['exception']), 'address' => $address, 'hotline' => $hotline, 'subjectimagewidth' => $modelsinfoarr['subjectimagewidth'], 'subjectimageheight' => $modelsinfoarr['subjectimageheight']);
require_once B_ROOT . './source/adminfunc/tool.func.php';
if ($consumeimgpath = image_text($createimgarr)) {
$setsqlarr['subjectimage'] = $consumeimgpath;
$setsqlarr['imagetype'] = 0;
$setsqlarr['imgtplid'] = intval($_POST['imgtplid']);
}
} else {
$uploadfilearr = $ids = array();
$subjectimageid = '';
$uploadfilearr = uploadfile(array(array('fieldname' => 'subjectimage', 'fieldcomment' => '圖片標題', 'formtype' => 'img')), $modelsinfoarr['mid'], 0, 1, $modelsinfoarr['subjectimagewidth'], $modelsinfoarr['subjectimageheight']);
if (!empty($uploadfilearr)) {
$feedsubjectimg = $uploadfilearr;
foreach ($uploadfilearr as $tmpkey => $tmpvalue) {
if (empty($tmpvalue['error'])) {
$setsqlarr[$tmpkey] = $tmpvalue['filepath'];
}
if (!empty($tmpvalue['aid'])) {
$ids[] = $tmpvalue['aid'];
}
}
}
if ($modelsinfoarr['modelname'] == 'consume') {
$setsqlarr['imagetype'] = 1;
}
}
/* --------- 標題圖片處理 End --------------*/
//詞語過濾
if (!empty($modelsinfoarr['allowfilter'])) {
$setsqlarr = scensor($setsqlarr, 1);
}
//發佈時間
$setsqlarr['dateline'] = $_G['timestamp'];
// 商品添加簡介
if ($mname == "good") {
$setsqlarr['intro'] = trim(strip_tags($_POST['intro']));
}
if (empty($itemid)) {
//插入數據
$itemid = inserttable($modelsinfoarr['modelname'] . 'items', $setsqlarr, 1);
if (in_array($modelsinfoarr['modelname'], array('good', 'notice', 'consume', 'album', 'groupbuy'))) {
示例5: modelpost
/**
* 模型在线投稿提交处理函数
*/
function modelpost($cacheinfo, $cp = 1)
{
global $_SGLOBAL, $theurl, $_SCONFIG;
include_once S_ROOT . './function/upload.func.php';
$_POST['mid'] = !empty($_POST['mid']) ? intval($_POST['mid']) : 0;
$itemid = !empty($_POST['itemid']) ? intval($_POST['itemid']) : 0;
$hash = '';
$op = 'add';
$resultitems = $resultmessage = array();
$modelsinfoarr = $cacheinfo['models'];
$columnsinfoarr = $cacheinfo['columns'];
if (empty($_POST['mid']) || $_POST['mid'] != $modelsinfoarr['mid']) {
showmessage('parameter_error');
}
$feedcolum = array();
foreach ($columnsinfoarr as $result) {
if ($result['isfixed'] == 1) {
$resultitems[] = $result;
} else {
$resultmessage[] = $result;
}
if ($result['formtype'] == 'linkage') {
if (!empty($_POST[$result['fieldname']])) {
$_POST[$result['fieldname']] = $cacheinfo['linkage']['info'][$result['fieldname']][$_POST[$result['fieldname']]];
}
} elseif ($result['formtype'] == 'timestamp') {
if (empty($_POST[$result['fieldname']])) {
$_POST[$result['fieldname']] = $_SGLOBAL['timestamp'];
} else {
$_POST[$result['fieldname']] = sstrtotime($_POST[$result['fieldname']]);
}
}
}
//更新用户最新更新时间
if (empty($itemid) && $_SGLOBAL['supe_uid']) {
updatetable('members', array('updatetime' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid']));
}
//输入检查
$_POST['catid'] = intval($_POST['catid']);
$_POST['allowreply'] = isset($_POST['allowreply']) ? intval($_POST['allowreply']) : checkperm('allowcomment') ? 1 : 0;
$_POST['subject'] = shtmlspecialchars(trim($_POST['subject']));
//检查输入
if (strlen($_POST['subject']) < 2 || strlen($_POST['subject']) > 80) {
showmessage('space_suject_length_error');
}
if (empty($_POST['catid'])) {
showmessage('admin_func_catid_error');
}
if (!empty($_FILES['subjectimage']['name'])) {
$fileext = fileext($_FILES['subjectimage']['name']);
if (!in_array($fileext, array('jpg', 'jpeg', 'gif', 'png'))) {
showmessage('document_types_can_only_upload_pictures');
}
}
//数据检查
checkvalues(array_merge($resultitems, $resultmessage), 0, 1);
//修改时检验标题图片是否修改
$defaultmessage = array();
if (!empty($itemid)) {
if (empty($_POST['subjectimage_value']) || !empty($_FILES['subjectimage']['name'])) {
//当file删除时,或修改时执行删除操作
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname($modelsinfoarr['modelname'] . 'items') . ' WHERE itemid = \'' . $itemid . '\'');
$defaultmessage = $_SGLOBAL['db']->fetch_array($query);
$hash = getmodelhash($_GET['mid'], $itemid);
deletetable('attachments', array('hash' => $hash, 'subject' => 'subjectimage'));
//删除附件表
updatetable($modelsinfoarr['modelname'] . 'items', array('subjectimage' => ''), array('itemid' => $itemid));
$ext = fileext($defaultmessage['subjectimage']);
if (in_array($ext, array('jpg', 'jpeg', 'png'))) {
@unlink(A_DIR . '/' . substr($defaultmessage['subjectimage'], 0, strrpos($defaultmessage['subjectimage'], '.')) . '.thumb.jpg');
}
@unlink(A_DIR . '/' . $defaultmessage['subjectimage']);
}
}
//构建数据
$setsqlarr = $setitemsqlarr = array();
$setsqlarr = getsetsqlarr($resultitems);
$setsqlarr['catid'] = $_POST['catid'];
$setsqlarr['subject'] = $_POST['subject'];
$setsqlarr['allowreply'] = $_POST['allowreply'];
if (checkperm('managefolder') || checkperm('managemodpost')) {
$setsqlarr['grade'] = intval($_POST['grade']);
} else {
$setsqlarr['grade'] = 0;
}
$setsqlarr['dateline'] = $_SGLOBAL['timestamp'];
$setsqlarr['uid'] = $_SGLOBAL['supe_uid'];
$setsqlarr['username'] = $_SGLOBAL['supe_username'];
$setsqlarr['lastpost'] = $setsqlarr['dateline'];
$modelsinfoarr['subjectimagewidth'] = 400;
$modelsinfoarr['subjectimageheight'] = 300;
if (!empty($modelsinfoarr['thumbsize'])) {
$modelsinfoarr['thumbsize'] = explode(',', trim($modelsinfoarr['thumbsize']));
$modelsinfoarr['subjectimagewidth'] = $modelsinfoarr['thumbsize'][0];
$modelsinfoarr['subjectimageheight'] = $modelsinfoarr['thumbsize'][1];
}
$uploadfilearr = $ids = array();
//.........这里部分代码省略.........
示例6: optional_param
// file or dir hash
$requestid = optional_param('requestid', "", PARAM_TEXT);
// file or dir hash
$paramone = optional_param('paramone', "", PARAM_TEXT);
// nature of value depends on datatype, maybe path
$paramtwo = optional_param('paramtwo', "", PARAM_TEXT);
// nature of value depends on datatype, maybe protocol
$paramthree = optional_param('paramthree', "", PARAM_TEXT);
// nature of value depends on datatype, maybe filearea
switch ($datatype) {
case "uploadfile":
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
//uploadfile filedata(base64), fileextension (needs to be cleaned), blah blah
//paramone is the file data, paramtwo is the file extension, requestid is the actionid
$returnxml = uploadfile($paramone, $paramtwo, $requestid, $contextid, $comp, $farea, $itemid);
break;
case "poodllpluginfile":
//poodllpluginfile($contextid,$component,$filearea,$itemid,$filepath,$filename);
//lets hard code this for now, very very mild security
poodllpluginfile($contextid, "mod_assignment", "submission", $itemid, "/", $paramone);
return;
case "getlast20files":
header("Content-type: text/html");
$returnxml = "";
echo "hi";
getLast20Files();
break;
case "getrepodata":
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
示例7: intval
$positions = intval($_POST['positions']);
//赛制图标 start
$articonpic = save($_POST['articonpic']);
$_iconpic = uploadfile("iconpic", $sortname);
$iconpic = empty($_iconpic) ? $articonpic : $_iconpic['FilePath'];
//赛制图标 end
$teamname1 = save($_POST['teamname1']);
//队列1图标 start
$artteampic1 = save($_POST['artteampic1']);
$_teampic1 = uploadfile("teampic1", $sortname);
$teampic1 = empty($_teampic1) ? $artteampic1 : $_teampic1['FilePath'];
//队列1图标 end
$teamname2 = save($_POST['teamname2']);
//队列2图标 start
$artteampic2 = save($_POST['artteampic2']);
$_teampic2 = uploadfile("teampic2", $sortname);
$teampic2 = empty($_teampic2) ? $artteampic2 : $_teampic2['FilePath'];
//队列2图标 end
$starttime = $_POST['starttime'] ? _strtotime($_POST['starttime']) : 0;
$endtime = $_POST['endtime'] ? _strtotime($_POST['endtime']) : 0;
$addtime = time();
$showstate = intval($_POST['showstate']);
//播放来源 start
$playsource = '';
if ($_POST['play_url'] && is_array($_POST['play_url'])) {
foreach ($_POST['play_url'] as $key => $val) {
$thisplay_url = save($val);
if ($thisplay_url) {
//排序 start
$numkey = addKey($playsource, $_POST['play_orders'][$key]);
//排序 end
示例8: king_def
function king_def()
{
$state = uploadfile('filedata');
echo json_encode($state);
}
示例9: fopen
$font = @$_POST['font'];
$userban = @$_POST['userban'];
$size = @$_POST['size'];
$theme = @$_POST['explorer-theme'];
$ban = @$_FILES['ban'];
$userfile = fopen(USER_CONF_FILE, 'x');
if ($userfile == FALSE) {
header("Status: 301 Moved Permanently", false, 301);
header("Location: http://{$host}");
exit;
} else {
fwrite($userfile, $id_code . "\r\n");
fwrite($userfile, $background . "\r\n");
fwrite($userfile, $font . "\r\n");
fwrite($userfile, $userban . "\r\n");
fwrite($userfile, $size . "\r\n");
fwrite($userfile, $theme);
fclose($userfile);
if ($userban == 'no') {
header("Status: 301 Moved Permanently", false, 301);
header("Location: http://{$host}/");
exit;
} else {
include 'inc/config/upload.php';
$userdir = 'css/img/user.jpg';
uploadfile($ban, $userdir);
}
header("Status: 301 Moved Permanently", false, 301);
header("Location: http://{$host}/");
exit;
}
示例10: exit
* @author coolmoo <idreamsoft@qq.com>
*/
!defined('iPATH') && exit('What are you doing?');
switch ($action) {
case 'editor':
$F = uploadfile("upload");
echo json_encode(array('err' => '', 'msg' => uploadfile("upload")["FilePath"]));
break;
case 'Aupload':
strpos($_POST['savedir'], '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
$F = uploadfile("file");
alert($F["OriginalFileName"] . '上传成功!', 'javascript:insert("' . $F["FilePath"] . '","' . $_POST['in'] . '");');
break;
case 'uploadfile':
strpos($_POST['savedir'], '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
$F = uploadfile("file", '', $_POST['savedir']);
alert($F["OriginalFileName"] . '上传成功!', 'javascript:window.parent.location.reload();');
break;
case 'createdir':
$dirname = $_POST['dirname'];
$savedir = $_POST['savedir'];
strpos($savedir, '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
strpos($dirname, '.') !== false && alert('目录不能带有.', 'javascript:void(0);');
createdir(iPATH . $iCMS->config['uploadfiledir'] . "/" . $savedir . $dirname);
alert("目录[{$dirname}]创建成功!", 'javascript:window.parent.location.reload();');
break;
case 'crop':
//header('Content-type: image/jpeg');
$tMap = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
$pic = $_POST['pFile'];
$iPic = getfilepath($pic, iPATH, '+');
示例11: upload
function upload($usuario, $empresa, $conexion)
{
if (get('VUP')) {
//VUP : Valida Upload
$filedata = (string) $_GET['filedata'];
$filedata = unserialize(base64_decode($filedata));
$return = array('filedata' => $filedata);
return $return;
}
$path = (string) post("path");
$filedata = (string) post("filedata");
$formId = (string) post("formId");
$campo = (string) post("campo");
$return = array('success' => false, 'msg' => 'No se pudo subir el archivo.');
if ($_FILES['error'] == UPLOAD_ERR_OK) {
$filedata = unserialize(base64_decode($filedata));
$filesize = $_FILES["file"]["size"];
$maxfile = $filedata["maxfile"] * 1024 * 1024;
if ($filesize <= $maxfile) {
$codigo = (int) numerador('archivoTemporal', 0, '');
$return = uploadfile($codigo, $_FILES, $path, $filedata["tipos"]);
if ($return['success']) {
//deleteFileTemporal($formId, $conexion);
insertFileTemporal($codigo, $return, $formId, $campo, $usuario, $empresa, $conexion);
}
} else {
$return['msg'] = "El archivo no puede superar los {$filedata["maxfile"]} Mb";
}
}
// return "daniel";
return $return;
}
示例12: msgexiterror
msgexiterror("notright", "", "disable");
exit;
}
}
if (isset($_FILES["userfile"])) {
if ($codekey == 7) {
demo();
}
if (!$path) {
echo "Path потерян... конец операции...";
exit;
} else {
if ($pr[68]) {
$redirecttoshare = 1;
}
$err = uploadfile($path, "original");
}
if ($err == false) {
echo "upload fail.";
}
if ($err == true) {
echo "upload complete.";
}
exit;
}
//echo "OSTYPE==$OSTYPE";
if ($pr[41]) {
$defaultpath = $pr[41];
} else {
if ($OSTYPE == "LINUX") {
$defaultpath = getcwd() . "/";
示例13: lprint
}
if ($publicdemo) {
$serial = "publicdemo";
}
if ($test) {
$serial = $testenable;
}
if (isset($_FILES["userfile"])) {
//проверяем посланный ключ //йух посылается , а не ключ... мдя интересно с какой это
// if ($go=="Send key") { //проверяем посланный ключ
$uploaddir = "_conf";
if ($size > 700) {
echo "Превышен hardcoded лимит в 300bytes";
exit;
}
if (uploadfile($uploaddir, "add.key")) {
lprint("FS_FWR");
} else {
lprint("FS_FWRFAIL");
}
//echo "2userfile=$userfile go=$go path=$path (disabled) ";
Header("Location: login.php");
//пофиксили баг с лишним обновлением. не пересылаем заново временно пока херня не пройдет
}
if ($prauth[$ADM][2] == false and $prauth[$ADM][11]) {
lprint("A_LOG_BAN");
?>
<form action="login.php" method="post"> <?php
submitkey("resetcookie", "LOGOUT");
echo "</form>";
exit;
示例14: news
if ($_POST["selectoption"] == "Новости") {
news($mysqli, $tmpl['newsAdmin']);
} else {
if (isset($_POST["selectedNews"])) {
if ($_POST["selectnews"] == "Новый вопрос") {
addnews($mysqli, $tmpl["addnews"]);
} else {
insertOrDeleteNews($mysqli, $tmpl["updatenews"], $_POST["selectnews"], $tmpl["updatecoments"]);
}
} else {
if (isset($_POST["addnew"])) {
$title = $_POST["title1"];
$category = $_POST["categorynews"];
$text = $_POST["text"];
$isHot = $_POST["isHot"];
uploadfile($mysqli);
addnewsDB($mysqli, $title, $category, $text, $isHot);
$_SESSION["list"] = $tmpl['mainAdmin'];
} else {
if (isset($_POST["insertnew"])) {
//получим id категории
$sth = $mysqli->prepare("SELECT id2 FROM Category2 WHERE categ2 = ? ");
$sth->bind_Param("s", $_POST["categorynews"]);
$sth->execute();
$result = $sth->get_result();
$obj = $result->fetch_assoc();
$idcat = $obj["id2"];
$result->close();
$hot = 0;
if ($_POST["isHot"] == "on") {
$hot = 1;
示例15: alert
} else {
alert('您没有任何数据编辑');
}
}
if ($action == 'add') {
$id = (int) $_POST['id'];
$name = save($_POST['name']);
$orders = intval($_POST['orders']);
$types = intval($_POST['types']);
!$types && alert('类型错误!');
!$name && alert('名称不能为空!');
if ($delpics) {
$pics = '';
} else {
$artpics = save($_POST['artpics']);
$_pics = uploadfile("pics", $name);
$pics = empty($_pics) ? $artpics : $_pics['FilePath'];
}
$returnurl = $_POST['returnurl'] ? rawurldecode($_POST['returnurl']) : 'admincp.php?do=events_playsource&operation=manage&types=' . $types;
$set = " `orders`='{$orders}',`name`='{$name}',`pics`='{$pics}' ";
if ($id) {
$up = $DreamCMS->db->query("UPDATE `#DC@__events_playsource` SET " . $set . " WHERE `types`='{$types}' AND `id`='{$id}' LIMIT 1 ");
if ($up !== false) {
redirect("编辑完成!", $returnurl, '2');
} else {
alert('编辑失败');
}
} else {
$set .= ",`types`='{$types}' ";
$add = $DreamCMS->db->query("INSERT INTO `#DC@__events_playsource` SET " . $set);
if ($add) {