本文整理汇总了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>