请教php上传文件出错 求解
请问php上传文件出错 求解!
在windows下正常 但是linux 就提示移动文件失败 求救啊!
代码如下
在windows下正常 但是linux 就提示移动文件失败 求救啊!
代码如下
<?php
include "../connss.php";
include "../checkA.php";
?>
<html>
<head>
<script language="javascript">
function check(){
if(upform.filesname.value==""){
alert("名称不能为空!");upform.filesname.focus();return false;
}
}
</script>
<style type="text/css">
body{font-size: 9pt;}
input{background-color: #66CCFF;border: 1px inset #CCCCCC;}
</style>
</head>
<body>
<p> </p>
<center>
<form enctype="multipart/form-data" method="post" name="upform">
轮播管理
:
<table width="616" border="1">
<tr>
<td width="54">标题:</td>
<td width="269"><input name="title" id="title" type="text" size="30"></td>
<td width="67">轮播序号</td>
<td width="198"><select name="id"id="id" onChange="showfont(this.options[this.selectedIndex].value)">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
</tr>
<tr>
<td>链接:</td>
<td height="24" colspan="3"><input name="linke" id="linke" type="text" size="50" value="#"></td>
</tr>
<tr>
<td> </td>
<td colspan="3"><input name="upfile" type="file">
<input name="submit" type="submit" value="上传" onClick="return check();"></td>
</tr>
</table>
</form></body></center>
<?php
$uptypes=array(
'image/jpg',
'image/jpeg',
'image/png',
'image/pjpeg',
'image/gif',
'image/bmp',
'image/x-png',
);
$max_file_size=2000000;
$destination_folder="../../img/slider/";
$filesname=$_POST[title];
$id=$_POST[id];
$link=$_POST[linke];
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (!is_uploaded_file($_FILES["upfile"][tmp_name]))
//是否存在文件
{
echo "图片不存在!";
exit;
}
$file = $_FILES["upfile"];
if($max_file_size < $file["size"])
//检查文件大小
{
echo "文件太大!";
exit;
}
if(!in_array($file["type"], $uptypes))
//检查文件类型
{
echo "文件类型不符!".$file["type"];
exit;
}
if(!file_exists($destination_folder))
{
mkdir($destination_folder);
}
$filename=$file["tmp_name"];
$image_size = getimagesize($filename);
$pinfo=pathinfo($file["name"]);
$ftype=$pinfo['extension'];
$destination = $destination_folder.time().".".$ftype;