本文整理汇总了PHP中upload::uploadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::uploadFile方法的具体用法?PHP upload::uploadFile怎么用?PHP upload::uploadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::uploadFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadmulti
/**
* 上传单个或多个文件
* @param int $type
* $type为0:上传图片
* $type为1:上传视频
*/
function uploadmulti($type)
{
// print_r($_FILES);die;
$files = getFiles();
$path = dirname(dirname(__FILE__));
//获取upload_image的上层目录的绝对路径
if ($type == 0) {
$uploadPath = $path . '/upload_image';
} else {
$uploadPath = $path . '/upload_video';
}
foreach ($files as $fileInfo) {
$upload = new upload($fileInfo, $uploadPath, false);
$dest = $upload->uploadFile();
$uploadFiles[] = $dest;
}
$uploadFiles = array_values(array_filter($uploadFiles));
return $uploadFiles;
}
示例2: uploadmulti
/**
* 上传单个或多个文件
* @param int $type
* $type为0:上传图片
* $type为1:上传视频
* $type为2:上传缩略图
*/
function uploadmulti($fileName, $type)
{
// print_r($_FILES);die;
$files = getFiles();
if ($type == 0) {
$uploadPath = '../../../common/upload_image';
} elseif ($type == 1) {
$uploadPath = '../../../common/upload_video';
} else {
$uploadPath = '../../../common/upload_thumb';
}
foreach ($files as $fileInfo) {
$upload = new upload($fileName, $fileInfo, $uploadPath, false);
$dest = $upload->uploadFile();
$uploadFiles[] = $dest;
}
$uploadFiles = array_values(array_filter($uploadFiles));
return $uploadFiles;
}
示例3: upload
<?php
header('content-type:text/html;charset=utf-8');
require_once 'upload.class.php';
//$upload = new upload('myFile1');
$upload = new upload('myFile1', 'test');
$dest = $upload->uploadFile();
echo $dest;
示例4: unset
unset($rs);
$page_nav = multi($total_num, $perpage, $pg, urr("mydisk", "item=profile&action={$action}"));
require_once template_echo('profile', $user_tpl_dir);
break;
case 'invite':
$invite_url = $settings['invite_register_encode'] ? $settings['phpdisk_url'] . urr("account", "action=register&" . pd_encode('uid=' . $pd_uid)) : $settings['phpdisk_url'] . urr("account", 'action=register&uid=' . $pd_uid);
// my downlines
$my_downlines = @$db->result_first("select count(*) from {$tpf}buddys where userid='{$pd_uid}'");
require_once template_echo('profile', $user_tpl_dir);
break;
case 'application_teacher':
if ($task == 'save_image') {
//增加保存图片的代码
require PHPDISK_ROOT . 'includes/class/upload.class.php';
$upload = new upload('file', APPLICATION_MATERIALS_DIR);
$fileName = $upload->uploadFile();
//清除显示
ob_get_clean();
echo json_encode(array('status' => 'ok', 'data' => array('filename' => basename($fileName)), 'msg' => '成功上传文件'));
exit;
} elseif ($task == 'application_add') {
//检查是否存在提交的信息
$application_one = get_application_teacher_status();
if ($application_one) {
$sysmsg = array('不能重复申请,请先取消当前教师申请');
redirect('back', $sysmsg);
exit;
}
//申请提交的代码
form_auth(gpc('formhash', 'P', ''), formhash());
$user_name = gpc('user_name');
示例5: array
<input type="file" name="myLogo" accept="image/jpeg,image/gif,image/png"/>
<br />
请选择你要上传的excel文件:
<input type="file" name="myExcel" accept="application/msexcel"/>
<input type="submit" value="上传信息" />
<br />
</form>
</center>
</body>
</html>
<?php
header('content-type:text/html;charset=utf-8');
require_once '../libs/upload.class.php';
require_once '../libs/upload_img.class.php';
require_once '../include.php';
if (!empty($_POST["bookName"])) {
//上传logo
$uploadimg = new upload_img("myLogo", "../logo");
$destexcel_img = $uploadimg->uploadFile();
// echo $destexcel_img;
//录入电话簿数据库
$phonebook = array("name" => $_POST["bookName"], "intr" => $_POST["intr"], 'logo' => $destexcel_img);
insert('phonebook', $phonebook);
// $sql = "INSERT INTO phonebook (name,intr,logo) VALUES('".$_POST["bookName"]."','".$_POST["intr"]."','".$destexcel_img."')";
// echo $sql.'<br />';
// $res = mysql_query($sql);
//上传excel表并解析
$uploadexcel = new upload('myExcel', '../excels', '5242880', array('xlsx', 'xls'));
$destexcel = $uploadexcel->uploadFile(mysql_insert_id());
// echo $destexcel;
}