Hello.
I have a multi file uploader that is working great. However, now I am trying to upload two different files into separate folders during each iteration of the loop from the multiloader.
The client is wanting an image in one folder and a thumbnail into another folder. They have decided that they want the thumbnail to be a totally different image, not a resized version of the main image.
What I was thinking is having a folder populated with all the main images, and in the same folder all the thumbnail icons in the same folder and titled the same, but with "_th" added before the extension ( fileone.jpg, fileone_th.jpg, filetwo.jpg, filetwo_th.jpg, ...), so the client could just pick all the main images for the multiloader and the php script would upload the main ones, but also upload the thumbnails into their folder.
Here is a very stripped down version of the script and I have tried some variances with no luck. Only the first main set of images are uploaded, not the thumbnail versions. Remember, these are different images than the first set, so I can't use copy(). I know one solution is to simply make the client use a different form just for the thumbnails, but it is a massive amount of images as well as some database records linking the main and thumb image, so I was hoping to just streamline the process right at the point of uploading.
if ($_POST[SubmitB] == "Upload File")
{
$tmpfile = $_FILES['uploadFile'] ['tmp_name'];
$pieces = explode(".", $tmpfile);
$thumbname = $pieces[0] . "_th." . $pieces[1];
move_uploaded_file ($tmpfile, "folder1/{$_FILES['uploadFile'] ['name']}");
move_uploaded_file ($thumbname, "folder2/{$_FILES['uploadFile'] ['name']}");
echo "File uploaded.";
}
I am assuming that the script ends after executing move_uploaded_file() or something simple I am just not aware of.
I appreciate any ideas of maybe a better way to approach this.
Thanks for your time!!