在此服务器上找不到请求的URL

时间:2014-01-30 05:36:49

标签: php mysql date fedora

我有保存一些数据和上传文件的代码。 我的文件存储在文件夹中,其名称存储在我的数据库中的一个字段中

运行Windows中的

代码并保存文件<如果我想下载文件,我没有任何问题

但在Linux服务器(fedora)上我成功收到消息。文件已上传 但是当我想下载它时,我得到了在此服务器上找不到请求的URL /projectsite/files_upload/MWE_db/07-59-39.pdf。
我打开了找不到的文件夹文件。为什么呢?

我的代码是

<?php
ini_set('display_errors','off');
date_default_timezone_set('Asia/Riyadh');
include ("../connect.php");
include ("connect.php");
mysql_query("SET NAMES utf8");

$Name=$_POST['nameofresearch'];
$Dates=$_POST['dateofstart'];
$Datee=$_POST['dateofend'];
$budget=$_POST['budget'];
$Names=$_POST['requestedby'];
$executingagency=$_POST['executingagency'];
$projectstatus =$_POST['projectstatus'];
$projectmanager =$_POST['projectmanager'];
$briefdes =$_POST['briefdes'];
if($_POST['expert'][0]) { $first_expert   = $_POST['expert'][0]; } else { $first_expert  = 0; }
if($_POST['expert'][1]) { $second_expert  = $_POST['expert'][1]; } else { $second_expert  = 0; }
if($_POST['expert'][2]) { $third_expert   = $_POST['expert'][2]; } else { $third_expert  = 0; }


//----------------------------
include("../config.php");
$fname = "ERI_db/".date("H-i-s").strstr($_FILES['fileupload']['name'],'.');
//----------------------------

$sql="INSERT INTO         $tbl_name(id,nameofresearch,dateofstart,dateofend,budget,requestedby,executingagency,     projectstatus,projectmanager,briefdes,filename,expert1,expert2,expert3) 
               VALUES(NULL, '$Name', '$Dates', '$Datee', '$budget',     '$Names','$executingagency', '$projectstatus', '$projectmanager', '$briefdes','$fname','$first_expert','$second_expert','$third_expert')";
$result=mysql_query($sql);

if($result)
{
    echo "Successful";
    echo "<BR>";
    //----------------------------------------
    if($_FILES['fileupload']['size']>0)
    {
        if(!in_array($_FILES['fileupload']['type'],$exten)){ $r.="امتداد الملف خطا -<br>";} 
        if(file_exists($dir.$_FILES['fileupload']['name'])){ $r.="الملف موجودة مسبقا -<br>";}
    if($_FILES['fileupload']['size']>$bigsize){ $r.="حجم الملف اكبر من المسموح به -<br>";}
}
if($r)
{
    echo $r;
    exit();
}
else
{
    if($_FILES['fileupload']['tmp_name'])
    {
        copy($_FILES['fileupload']['tmp_name'],$dir.$fname);
        echo "File is uploaded";
        echo "<BR>";
    }

}
//----------------------------------------
}



else
{
echo "ERROR";
echo "<br>";
echo mysql_error();
echo "<a href='expertformadd.php'><br>Please try again </a>";
}
mysql_close($conn);

?>

和config.php文件是

<?php

// this is for determined folder for store files when user upload it and what is type and size of it

$dir     = "../files_upload/";

$exten   = array("text/plain","application/pdf","application/msword","application/octet-stream","application/x-zip-compressed","image/pjpeg","image/gif","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation");

$bigsize = "5500000";
?>

0 个答案:

没有答案