本文整理匯總了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;
}