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? Link to comment https://forums.phpfreaks.com/topic/222313-quick-question-copying-images/ 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 ++; } ?> Link to comment https://forums.phpfreaks.com/topic/222313-quick-question-copying-images/#findComment-1149973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.