Rifts Posted December 21, 2010 Share Posted December 21, 2010 I'm using copy() to copy an image to a different directory. The problem is the image could be in 1 of 3 folders. With out knowing which folder its in how can I do this? Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 21, 2010 Share Posted December 21, 2010 what DO you know about the images? might modify this <?php $path_array = array("folder1/","folder2/","folder3/"); $short_filename = 'myimage.jpg'; $i=0; while($i<3){ $filename = $path_array[$i] . $short_filename; if (file_exists($filename)) { /* use your copy file code here */ $i = 3; /* exit the while */ } $i ++; } ?> 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.