本文整理匯總了PHP中UploadFile::upload_file方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadFile::upload_file方法的具體用法?PHP UploadFile::upload_file怎麽用?PHP UploadFile::upload_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadFile
的用法示例。
在下文中一共展示了UploadFile::upload_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: UploadFile
<?php
header("Content-Type: text/html;charset=utf-8");
/**
* 功能:上傳文件
* @author gaoqing
* 2015年6月29日
*/
if (isset($_POST['upload_button'])) {
//判斷是否上傳了圖片
include '../UploadDownload/UploadFile.class.php';
$uploadFile = new UploadFile($_FILES['fileName'], "image");
echo $uploadFile->upload_file();
}
?>
<form action = "#" method = "POST" enctype="multipart/form-data">
<label>上傳文件:</label>
<input type="file" name = "fileName" value = "">
<input type="submit" name = "upload_button" value = "上傳文件">
</form>
示例2: UploadFile
<?php
//測試文件上傳
//by indraw
//2004/11/10
error_reporting(E_ERROR | E_WARNING | E_PARSE);
include 'UploadFile.class.php';
$upload = new UploadFile();
//-----------------------------------------------------------------------------
if (!empty($_POST['action']) && $_POST['action'] == 'upload') {
$aaa = $upload->upload_file('./', 'md5', 10);
//如果是圖片,可以更改大小。
//$upload->img_resize('./up',$aaa[file1], 120, true);
//顯示更改後的文件名
print_r($upload->_files);
}
//$upload->deleteFile('/up', $aaa[file1]);
$upload->display_files('./');
//-----------------------------------------------------------------------------
?>
<form action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="POST" name="upload" ENCTYPE="multipart/form-data">
<input type="file" name="file1"><br>
<input type="file" name="file2"><br>
<input type="file" name="file3"><br>
<input type="submit" value="你確定上傳嗎?">
<input type="hidden" name="action" value="upload">
</form>