Jump to content

is_dir function


Schlo_50

Recommended Posts

Hey guys,

 

Could someone take a look at this and give me a few pointers. Im trying to check whether a folder exists before uploading to it. If it doesn't exist I want to forward the user to another page, else continue upload.

 

$refa = "folder";

 

if is_dir("clients/".$refa."") = false {
	print "<meta http-equiv=\"refresh\" content=\"0;url=http://www.site.com/f.php\">";
	} else {

     $upload = ftp_put($conn_id, $destination_file, $file, FTP_BINARY);  // upload the file
     if (!$upload) {  // check upload status
        print "<meta http-equiv=\"refresh\" content=\"0;url=http://www.site.com/f.php\">";
     } else {
        print "<meta http-equiv=\"refresh\" content=\"0;url=http://www.site.com/a.php\">";
     }

     ftp_close($conn_id); // close
 }
 }

 

Any ideas?

Thanks

Link to comment
Share on other sites

is_dir is a function that will return true or false so not need to use == false

 

if(!is_dir("clients/".$refa.""){

 

The ! infront of a function will check if the function returns false. Without the ! you ask if it is true.

 

Ray

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.