close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Delete specific Image File when uploading new images.

Thread began 6/24/2010 10:25 am by Digibug | Last modified 6/28/2010 10:31 am by Digibug | 4012 views | 5 replies


Delete specific Image File when uploading new images.

This is hard to explain so please hang in there!!

Ok I have a form that is allowing users to upload a total of 12 images, the images upload to a specified folder and data is inserted into the database. Users can re-upload any of the 12 images they want so for example they can choose to replace image 3, 5 & 7 buy clicking the upload file and then clicking the upload button, the files are then replaced on the server and the name is exactly the same, this works like a charm.

What I have also done is created an image cropping section where users can click any of the 12 images they've uploaded and this will then alow them to crop a section of the image and this then saves a new photo to the server called img1-cropped.jpg

Still with me!!

What I really need to do is get the update page to delete any of these cropped images from the server when a new photo is uploaded, so for example, if i upload a new photo to replace image1.jpg I need the form to remove img1-cropped.jpg during the same process. This so when the user view the crop image page they don't see the wrong (old) image anymore.

I though i cracked it by including:

$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../../assets/uploads/events/images/", "".$row_DLA_Event['ID'] ."img12-cropped.jpg");

Within the WA_DFP_SetupUploadStatusStruct command, it works BUT it removes every cropped image even if i only upload one new photo, here is the small code block i used.

WA_DFP_UploadFiles("WA_UploadResult2", "new_img1", "0", "", "JPG:70", $WA_UploadResult2_Params);
$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../../assets/uploads/events/images/", "".$row_DLA_Event['ID'] ."img1-cropped.jpg");
WA_DFP_UploadFiles("WA_UploadResult3", "new_img2", "0", "", "JPG:70", $WA_UploadResult3_Params);
$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../../assets/uploads/events/images/", "".$row_DLA_Event['ID'] ."img2-cropped.jpg");
WA_DFP_UploadFiles("WA_UploadResult4", "new_img3", "0", "", "JPG:70", $WA_UploadResult4_Params);
$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../../assets/uploads/events/images/", "".$row_DLA_Event['ID'] ."img3-cropped.jpg");

Do you know how I can achieve this, delete a specific file from the server that matches the relevent image uploaded.

Really hope this makes sense, i've posted quite a few times with different problems throughout the forum without much resolve so am hoping to crack this one.


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...