Forums

PHP

This topic is locked

Upload File Problem

Posted 14 Jul 2004 22:00:57
1
has voted
14 Jul 2004 22:00:57 Ulla Schirmbeck posted:
SO I created this Upload File page after following the tutorial here on DMXzone, but when it does not work: parse error on line 2 which is:    if($_POST['action'] == "upload"{
Does anybody know why?
Thankxxx 1000xxx for helping!

<?php
    if($_POST['action'] == "upload"{
         $uploadDirectory = "www.ulla.nl/incoming/";
         # Check Upload Directory Exists
         if(!ile_exists($uploadDirectory)){
             if(!mkdir($uploadDirectory,0777)){
                  die("User Upload directory could not be created";
             }
         }
         for($i=1;$i <= 3; $i++){
             $currentImage = "image" . $i;
             if(strlen($_FILES[$currentImage]['name']) > 0){
                  $tempFile = $_FILES[$currentImage]['tmp_name'];
                  $originalName = $_FILES[$currentImage]['name'];
                  $newPath = $uploadDirectory . $originalName;
                  if(@move_uploaded_file($tempFile,$newPath) === "FALSE"{
                       die("File image " . $i . " could not be written";
                  }
             }
         }
    }
    ?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="<?php echo $_SERVER['PHP_TYPE']; ?>" method="post" enctype="multipart/form-data" name="uploadForm" id="uploadForm">
<p>Upload Filename:
<input name="image1" type="file" id="image1">
</p>
<p>Upload Filename:
<input name="image2" type="file" id="image2">
</p>
<p>Upload Filename:
<input name="image3" type="file" id="image3">
</p>
<p>
<input name="MAX_FILE_SIZE" type="hidden" id="MAX_FILE_SIZE" value="1048576">
<input name="action" type="hidden" id="action" value="upload">
<input type="submit" name="Submit" value="Upload File">
</p>
</form>
</body>
</html>

Reply to this topic