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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.