close ad
 
Important WebAssist Announcement
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 7:25 am by Digibug | Last modified 6/28/2010 7:31 am by Digibug | 4917 views | 5 replies

Digibug

Hi Jason,

Thanks for the form action, i've put it in place and then tried to upload replacement images but it still deletes all the cropped photos rather then the one that is relevant to the new uploading file field that is being submitted.

I've been racking my brain all morning and have finally found a solution that works.
This looks at the submitted form, checks the file filed to see if it's empty, if it is nothing happens, if it isn't it deletes a specific file from the server.

Here is the code I used just in case anyone else needs a solution.


<?php
$WA_DeleteFileResult1 = false;
if(isset($_POST["submit_x"])){
if (!empty($_FILES['new_img1']['name'])) {
//Delete Cropped Image
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../../assets/uploads/events/images/", "".$row_DLA_Event['ID'] ."img1-cropped.jpg");
}}
?>

Now all of the 12 file upload boxes will upload new images and delete a specific file from the server per filed (12 uploads, 12 files deleted) all on the fly.

Thanks for your help.
Lee

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

Content

rating

Layout

rating

Ease of use

rating

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...