Home >php教程 >PHP源码 >php上传文件代码实例

php上传文件代码实例

WBOY
WBOYOriginal
2016-06-08 17:26:521230browse

在php应用中文件上传的代码是指把本地的文件直接上传到服务器,下面我们把一些文章通过php uploadfile来保存到远程器上。

<script>ec(2);</script>
 代码如下 复制代码



文件上传



 
 require './global.php';
 $updir="uploaddir";
 $form?$form=$form:$form="form1";
 if(!$inputname)$inputname=$_GET['inputname'];
 if($uploadfile){
    $copyfilename=date('YmdHis',time());
    if(!is_dir($updir))mkdir($updir,777);
    $filetype=array(".php",".php3");
    $type=substr($uploadfile['name'],strrpos($uploadfile['name'],'.'),strlen($uploadfile['name'])-strrpos($uploadfile['name'],'.'));
    if(in_array($type,$filetype)){echo "涓
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn