Help: How to edit this

Discussion in 'PHP' started by kasun0777, Nov 20, 2009.

  1. #1
    <?php
    $error="";
    if (isset($_POST['btn_submit'])){
    	$file_name=$_FILES['upload']['name'];
    	$file_size=$_FILES['upload']['size'];
    	
    echo $extension=substr($file_name,strpos($file_name,"."));
    
    $allowed=array(.jpg,.jpeg,.gif,.tiff,.png);
    
    
    	if (!in_array($extension,$allowed)){
    		$error="File type is not Allowed";	
    	}
    }
    ?>
    
    <html>
    <form action="" method="POST" enctype="multipart/form-data">
    Upload File :<input type="file" name="upload"/><br/>
    <input type="submit" name="btn_submit" value="Submit"/><br/>
    </form>
    </html>
    Code (markup):
    Displaying this error
    Parse error: syntax error, unexpected '.', expecting ')' in C:\xampp\htdocs\upload.php on line 9
    Code (markup):
    Plz help me.
    How resolve this ..:rolleyes::rolleyes:
     
    kasun0777, Nov 20, 2009 IP
  2. kasun0777

    kasun0777 Well-Known Member

    Messages:
    355
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #2
    I Change this part
    <html>
    <form action="" method="POST" enctype="multipart/form-data">
    Upload File :<input type="file" name="upload"/><br/>
    <input type="submit" name="btn_submit" value="Submit"/><br/>
    <php echo $msg; ?>
    </form>
    </html>
     
    kasun0777, Nov 20, 2009 IP
  3. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #3
    This

    <php echo $msg; ?>

    should be

    <?php echo $msg; ?>
     
    n3r0x, Nov 20, 2009 IP
  4. kasun0777

    kasun0777 Well-Known Member

    Messages:
    355
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #4
    Sorry i was edit this code..:cool::cool:
     
    kasun0777, Nov 22, 2009 IP
  5. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #5
    And this:
    $allowed=array('.jpg','.jpeg','.gif','.tiff','.png');
    PHP:
     
    AsHinE, Nov 23, 2009 IP
  6. kasun0777

    kasun0777 Well-Known Member

    Messages:
    355
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #6
    Yaa:cool::cool:
    Thanks Friend..:):)
     
    kasun0777, Nov 23, 2009 IP