#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    I am looking for help with adding an IF statement to my website. I have users that upload pictures to the website, and I have the PHP upload function running to take care of it.

    The problem is that I have an Update page that people go into and the update there information, apart of that is NEW uploads. If the users dont put in new information for the upload section, they will get an error message on the results screen.

    Error message:

    Warning: Unable to open '/tmp/none' for reading: No such file or directory in /home/mydomain.com/www/update_act.php on line 34
    failed to copy file

    Could someone give me an example of how to put an IF statment in the following code so that if NOTHING is placed in the upload fields it will skip the "do_upload" section?

    Part of PHP code:
    <?php

    do_upload1($picfile1,$newname1);
    do_upload2($picfile2,$newname2);
    ?>

    Thanks VERY much!!
  2. #2
  3. No Profile Picture
    Viper_SB
    Guest
    Devshed Newbie (0 - 499 posts)
    When I use a upload page if no file is selected the var $userfile returns "none" so I just do

    if ($userfile != "none") { echo "Do what ever"; }

    ------------------
    Viper_SB
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    I am still doing something wrong. It uploads the files, but will not display the right message now... What syntax is wrong?

    All I get is the same two messages:

    no file uploaded1. no file uploaded2.

    Wether I upload or not I still get these two messages.


    <?php
    if ($picfile1 != "/tmp/none") { echo "no file uploaded1."; }

    else
    {
    do_upload1($picfile1,$newname1);
    echo "1st file uploaded Successfully.";
    }

    if ($picfile2 != "/tmp/none") { echo "no file uploaded2."; }

    else
    {
    do_upload2($picfile2,$newname2);
    echo "2nd file uploaded Successfully.";
    }
    ?>

IMN logo majestic logo threadwatch logo seochat tools logo