Home  >  Article  >  Backend Development  >  请教php上传文件出错 求解

请教php上传文件出错 求解

WBOY
WBOYOriginal
2016-06-13 11:56:51806browse

请问php上传文件出错 求解!

本帖最后由 l34827584 于 2014-05-10 18:06:37 编辑 在windows下正常 但是linux 就提示移动文件失败 求救啊!
代码如下
<?php <br />include "../connss.php";<br>include "../checkA.php";<br>?><br><br><br><script><br />function check(){<br />	if(upform.filesname.value==""){<br />		alert("名称不能为空!");upform.filesname.focus();return false;<br />	}<br />}<br /></script><br><style>  <br />body{font-size: 9pt;}  <br />input{background-color: #66CCFF;border: 1px inset #CCCCCC;}  <br /></style>  <br><br><br><p> </p><br><center>
<br><form>
<br>  轮播管理<br>    :  <br>    <table>
<br>    <tr>
<br>      <td>标题:</td>
<br>      <td><input></td>
<br>      <td>轮播序号</td>
<br>      <td><select><br>                              <option>1</option>
<br>                              <option>2</option>
<br>                              <option>3</option>
<br>                            </select></td>
<br>    </tr>
<br>    <tr>
<br>      <td>链接:</td>
<br>      <td><input></td>
<br>    </tr>
<br>    <tr>
<br>      <td> </td>
<br>      <td>
<input><br>      <input>
</td>
<br>    </tr>
<br>  </table>
<br>
</form>
</center><br><?php   <br /><br>$uptypes=array(  <br>    'image/jpg',  <br>    'image/jpeg',  <br>    'image/png',  <br>    'image/pjpeg',  <br>    'image/gif',  <br>    'image/bmp',  <br>    'image/x-png',<br>);  <br>$max_file_size=2000000;<br>$destination_folder="../../img/slider/";<br><br>$filesname=$_POST[title];<br>$id=$_POST[id];<br>$link=$_POST[linke];<br>if ($_SERVER['REQUEST_METHOD'] == 'POST')  <br>{  <br>    if (!is_uploaded_file($_FILES["upfile"][tmp_name]))  <br>    //是否存在文件  <br>    {  <br>         echo "图片不存在!";  <br>         exit;  <br>    }  <br>    <br>    $file = $_FILES["upfile"];  <br>    if($max_file_size     //检查文件大小  <br>    {  <br>        echo "文件太大!";  <br>        exit;  <br>    }  <br>  <br>    if(!in_array($file["type"], $uptypes))  <br>    //检查文件类型  <br>    {  <br>        echo "文件类型不符!".$file["type"];  <br>        exit;  <br>    }  <br>  <br>    if(!file_exists($destination_folder))  <br>    {  <br>        mkdir($destination_folder);  <br>    }  <br>  <br>    $filename=$file["tmp_name"];  <br>    $image_size = getimagesize($filename);  <br>    $pinfo=pathinfo($file["name"]);  <br>    $ftype=$pinfo['extension'];  <br>    $destination = $destination_folder.time().".".$ftype;  <div class="clear">
                 
              
              
        
            </div>
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