SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Image upload

  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image upload

    Hey,

    I am trying to upload an image only if there is something in the file upload box, with the following code.

    PHP Code:
                    if($_POST['file'] == "")
                    {
                                      
    //dont do the image upload
                    
    }
                    else
                    {
                                     
    //do the image upload
                                    

    Why wont this work?

    Regards

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You need to look in $_FILES not $_POST.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh!

    you caught me out

    Regards


Bookmarks

Posting Permissions

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