Jump to content

Check for the image. if != continue with the resto of the script.


Julian

Recommended Posts

Hi guys...

I have this script that checks for an image.  But if the image is there I want the script to continue with the rest keeping the image already uploaded.  Can anyboy help me with this....  Here's code:

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")){

      $file_type = $_FILES['imgfile']['type'];
      $file_name = $_FILES['imgfile']['name'];
      $file_size = $_FILES['imgfile']['size'];
      $file_tmp = $_FILES['imgfile']['tmp_name'];

      if(!is_uploaded_file($file_tmp)){
      exit(); //I don't want to exit but continue with the rest of the scrip just don't execute what's related to the image.
      }
      $getExt = explode ('.', $file_name);
      $file_ext = $getExt[count($getExt)-1];
      bla,bla,bla..... etc.......

  I want the script continues here:
    $insertSQL = sprintf("UPDATE.......

Really appreciated your help..... Alaways the best.
if you do not want to carry out any action if the "if" statement is true the put nothing there i.e
[code]

if ( the file is uploaded) {

} else {
do something
}
[/code]

or a better way to do it is to reverse the if statement so you only carry out something if it is true i.e

[code]
if ( the file is not uploaded) {
do this
}

[/code]

you do not need an else statement at all then and it will carry on with the rest of the code.

hope that helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.