How to know the type of file and size?

Discussion in 'PHP' started by neha2011, May 4, 2011.

  1. #1
    Hi all,
    Wish you a Happy New Year to all.

    In one of my page,
    i asked user to upload the image by using browse button from the local system.
    It is working fine.
    but it uploads not only the image format, it accepts any type.
    Now i want to check the type of the format and if it is any of image formats it will accept otherwise it will show an alert type of message.

    And also, based on the image type, i want to put some limitations based on the memory...

    How to do that..

    Give me some help regarding this....

    Thanking you..
     
    neha2011, May 4, 2011 IP
  2. Mak3MyDay

    Mak3MyDay Peon

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    get and check the filetype using this $_FILES["name"]["type"]
    or take a look at w3schools tutorial: http://www.w3schools.com/PHP/php_file_upload.asp
     
    Mak3MyDay, May 4, 2011 IP