本文整理汇总了PHP中uploader::upFile方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::upFile方法的具体用法?PHP uploader::upFile怎么用?PHP uploader::upFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::upFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
$uploader->upFile('9999_' . time() . rand(1000, 9999));
mylog('frontUp');
$inf = $uploader->getFileInfo();
if ('SUCCESS' == $inf['state']) {
$id = pdoInsert('ad_tbl', array('category' => 'banner', 'img_url' => $inf['url']), '');
$inf['id'] = $id;
}
// header('contentType:application/json');
$jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
mylog('imgUploaded:' . $jsonInf);
echo $jsonInf;
exit;
}
if (isset($_FILES['parts-img-up'])) {
$uploader = new uploader('parts-img-up');
$uploader->upFile($_GET['g_id'] . '_' . time() . rand(1000, 9999));
$inf = $uploader->getFileInfo();
$jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
if ('SUCCESS' == $inf['state']) {
mylog('success');
$temp = pdoQuery('g_image_tbl', null, array('g_id' => $_GET['g_id']), 'limit 1');
if (!($row = $temp->fetch())) {
pdoInsert('g_image_tbl', array('g_id' => $_GET['g_id'], 'url' => $inf['url'], 'remark' => $inf['md5']), 'ignore');
mylog("create record");
} else {
pdoUpdate('g_image_tbl', array('remark' => $inf['md5'], 'url' => $inf['url']), array('g_id' => $_GET['g_id']));
$query = pdoQuery('image_view', null, array('remark' => $row['remark']), ' limit 1');
if (!($t = $query->fetch())) {
unlink('../' . $row['url']);
mylog('unlink"../' . $row['url']);
} else {