无法在linux服务器上传文件

时间:2015-09-17 12:47:20

标签: php linux file upload

我想在linux服务器上传文件,但它不起作用。在本地它可以很好地工作但在服务器中没有。我不知道出了什么问题。即使我尝试在compare.php中回显它也没有显示任何内容。

上传代码:

<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <?php
    $bdd = DB::getInstance();
    $reponse = $bdd->query('SELECT refCustomer, legalCompanyName FROM PV1.Client order by Client.legalCompanyName');
    $donnees = $reponse->fetch();
    ?>
    <form method="post" action="compare.php" enctype="multipart/form-data">
        <p>
        <label for="client">Veuillez choisir le fournisseur :</label><br />
           <select name="client" id="client">
            <?php
            echo '<option value=""/></option>';
            while ($donnees = $reponse->fetch()){
                    echo '<option value='.$donnees['refCustomer'].'>'.$donnees['legalCompanyName'].' </option>';                               
            }
            $reponse->closeCursor();
            ?>
           </select>
        </p>
        <input type="hidden" name="MAX_FILE_SIZE" value="3145728" />
        <input type="file" name="monfichier" />
        <p>
            <input type="submit" name="envoyer" value="Envoyer" class="myButton"/>
        </p>
    </form>
</body>

和compare.php

$dossier = '';
echo "test";

if(isset($_POST['client'])){
$cin = $_POST['client'];
if(!empty(basename($_FILES['monfichier']['name']))){
    $file = basename($_FILES['monfichier']['name']);
    echo is_writable($file). "</br>";
    $taille_maxi = 3145728;
    $taille = filesize($_FILES['monfichier']['tmp_name']);
    $extensions = array('.xls', '.xlsx');
    $extension = strrchr($_FILES['monfichier']['name'], '.');
    //Début des vérifications de sécurité...
    if(!in_array($extension, $extensions)){
         $erreur = 'Vous devez uploader un fichier de type .xls';
    }

    if($taille>$taille_maxi){
         $erreur = 'Le fichier est trop gros...';
    }


    $rateSheet=NULL;
    if($extension == ".xls"){
        $rateSheet = Parser::parserXls($dosser.$file);
    }else{
        echo "Veuillez uploader un fichier Excel";
    }

...

0 个答案:

没有答案