Increment file name problem
Hi all
I'm trying to upload multiple images data and images to a table prop_images which relate to one record in another table prop_details by redirecting back to the images input form after each sumbit.
The upload and insert record works each time, however the file name only increments once (adds _1.jpg) and then keeps adding _1.jpg so files images are being overwritten. I'm using a variable as the main part of the file name and concaternating with [Increment].jpg for the rename new file action if file exists.
Can anyone help? - Code is below.
Thanks
Phil
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert_x"])){
WA_DFP_UploadFile("WA_UploadResult1", "img_thumb", "../images/tns/tn_default.jpg", "../images/tns/", "".$row_propid_for_ims['prop_id'] .".jpg", "2", "".$row_propid_for_ims['prop_id'] ."_[Increment].jpg", "0", "false", "0", "0");
}
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["Insert_x"])){
WA_DFP_UploadFile("WA_UploadResult2", "img_main", "../images/main/default_main.jpg", "../images/main/", "".$row_propid_for_ims['prop_id'] ."", "2", "".$row_propid_for_ims['prop_id'] ."_[Increment].jpg", "0", "false", "0", "0");
}
?>