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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.