thenewperson Posted December 7, 2009 Share Posted December 7, 2009 Hey, i was messing around with uploads and iframe. I have a upload.php page and upload-file.php page. The upload.php page contains stuff seen by viewer while upload-file.php contains the testing for the files. The upload works perfectly however im trying to add something for when file exists already. if file exists show javascript alert upload-file.php if(file_exists($file)){ $filefailed = "<script type=\"text/javascript\">alert('This file already exists: Please rename your file');</script>"; echo $filefailed; } Since im using iFrames the code above will execute right away and alert. This is one problem of mine but main one i am trying to do is when i upload a file that exists it does not show. I have tryed using a while loop with variable to count it to 1 than reset it to 0 $filecounter = 0 while($firecounter < 1){ if(file_exists($file)){ $filefailed = "<script type=\"text/javascript\">alert('This file already exists: Please rename your file');</script>"; echo $filefailed; $filecounter++; } } However the only time this alert will show is on the load when iframe loads the test page. It will not alert when i try to upload file that exists already. Link to comment https://forums.phpfreaks.com/topic/184239-question-on-upload/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.