Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2006
    Location
    Queensland Oz
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How do I get the true image name from this?

    This may be a silly question.

    I am using this to select a photo for upload and resizing

    <form action="addinfo.php" encType="multipart/form-data" method="post" name="sendform">
    <input name=MAX_FILE_SIZE type=hidden value=1000000>
    <input name=image type=file ACCEPT="image/jpeg, image/jpg">
    <input type=submit name=submit value=Submit>
    </form>

    Question is, how to I get the true image name from this to check if file exists before addinfo.php does the upload, resizing and whatever?

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,770
    Thanks
    19
    Thanked 155 Times in 146 Posts
    I don;t know if this quite answers your question, but there are couple ways to validate image files:

    1) is_file() -- http://us2.php.net/manual/en/function.is-file.php
    2) getimagesize() -- http://us2.php.net/manual/en/function.getimagesize.php

    and maybe more ways that I cant think of right now...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use the $_FILES global to get the name
    http://uk.php.net/features.file-upload

  • #4
    New Coder
    Join Date
    Apr 2006
    Location
    Queensland Oz
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks degsy, I spent a few hours looking for that yesterday.
    Much appreciated


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •