Jump to content

upload file script problem


alin19

Recommended Posts

<body>
<form action="uploader.php" method="post" enctype="multipart/form-data" name="upload" id="upload">
    <input type="file" name="fisier" />
    <br />
    <input type="submit" name="upload" value="Uploadeaza" />
      <input type="reset" name="resetare" value="Reseteaza" />
</form>
</body>

<?php
if ($_FILES["fisier"]["error"] > 0)
  {
    echo "A intervenit o eroare: " . $_FILES["fisier"]["error"] . "<br />";
    }
    else
    {
    if (file_exists("upload/" . $_FILES["fisier"]["name"]))  // verificam daca fisierul exista deja pe server
     {
          echo "Fisierul pe care incerci sa-l uploadezi exista deja";
       }
    else
    {
    move_uploaded_file($_FILES["fisier"]["tmp_name"], "director/".$_FILES["fisier"]["name"]);  // se muta fisierul din directorul temporar al serverului in directorul final
     }
}
?>

Notice: Undefined index: fisier in c:\program files\easyphp1-8\www\first\uploader.php on line 2

 

Notice: Undefined index: fisier in c:\program files\easyphp1-8\www\first\uploader.php on line 8

 

 

Link to comment
https://forums.phpfreaks.com/topic/120986-upload-file-script-problem/
Share on other sites

Try changing this

 

<body>
<form action="uploader.php" method="post" enctype="multipart/form-data" name="upload" id="upload">
    <input type="file" name="fisier" />
    <br />
    <input type="submit" name="upload" value="Uploadeaza" />
      <input type="reset" name="resetare" value="Reseteaza" />
</form>
</body>

 

To this

 

<body>
<form action="uploader.php" method="post" enctype="multipart/form-data" name="upload" id="upload">
    <input type="file" name="fisier" id="fisier" />
    <br />
    <input type="submit" name="upload" value="Uploadeaza" id="upload"/>
      <input type="reset" name="resetare" value="Reseteaza" id="resetare" />
</form>
</body>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.