How do i check the an image before uploading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syam
    New Member
    • Dec 2006
    • 28

    How do i check the an image before uploading

    Hai frnds.....

    Please Help me. I want to validate an image befor uploading, to check whether it is a valid image or not
  • treecool
    New Member
    • Jan 2007
    • 6

    #2
    there is many way..
    the way that i usually used is comparing the extension of the file.
    with " substr " command --> see PHP manual for the rest.

    Comment

    • bsprogs
      New Member
      • Jan 2007
      • 6

      #3
      One thing I did with my uploader script was to upload the image to a defined hidden located on the server and submit the information on the file to a query table in my database.
      Then when I log in, the images will appear on my screen in order of their upload and I can verify them that way.

      So,

      File is uploaded
      File is placed in "uploads/queue/" folder.
      File Information is placed in my "queue" table.

      When I verify the image
      File is moved from "uploads/queue" to "uploads"
      File information in database is moved from "queue" table to "files" table.

      Hope that helps give you an idea where to start.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by syam
        Hai frnds.....

        Please Help me. I want to validate an image befor uploading, to check whether it is a valid image or not
        What do you mean by valid? Just that it is an image? Or do you want to accept only certain types of images, e.g. only .gif, .jpg, .png, .bmp, etc.? Or do you want to limit the file size? Or do you want to limit the image dimensions?

        Comment

        Working...