Schlo_50 Posted March 6, 2008 Share Posted March 6, 2008 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 https://forums.phpfreaks.com/topic/94718-is_dir-function/ Share on other sites More sharing options...
craygo Posted March 6, 2008 Share Posted March 6, 2008 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 https://forums.phpfreaks.com/topic/94718-is_dir-function/#findComment-484910 Share on other sites More sharing options...
Schlo_50 Posted March 6, 2008 Author Share Posted March 6, 2008 Bravo! Thanks, just what I needed. Link to comment https://forums.phpfreaks.com/topic/94718-is_dir-function/#findComment-484930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.