close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DELETE FILE - only if field is not empty

Thread began 3/25/2013 3:01 pm by Cologne | Last modified 3/26/2013 1:48 pm by Jason Byrnes | 953 views | 4 replies |

Cologne

DELETE FILE - only if field is not empty

Hi,
I need so more trigger.
It is up to the user if he uploads an image. So the field can be blank.
I the user wants to delete his account I need to delete the images, too, IF there is one.
So, I need a trigger, if the

<?php echo $row_imageName['image']; ?>

is empty or not, and then the button pressed trigger.
how does that work?
Denis

Sign in to reply to this post

Cologne

OK; I think I got it.
I used $_POST[myHiddenField] as trigger and it triggers if not empty, so this works.
do I need to take care for something else?
Cheers,
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

That should work.

Sign in to reply to this post

Cologne

This works.

I need some advice, or better, am I doing right.

The user can upload an image on a profile update page. Will say, the image filed is empty.
And I store nothing in the hidden field for the current image.

The new image, if the user uploads an image gets a random password (SA) that I store in a session when button pressed.

So, am I right, that I need 2 triggers for the old image delete function?

Cause, if the hidden field for the current image is empty I get an error message.
Then I need an other trigger to check if an upload was done, to delete the old image.

if there is no image, take the hidden field (current image) as default in the upload, and so it stays empty.

in case of upload a new image, the hidden field is not empty, the upload is done, so the old image can be deleted.

is this the right way, or is there an other, better way to do this.

Cheers,
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

you could add an additional if statement around the delete file behavior so it only triggers if a a file name exists in the data base:

<?php if($row_recordsetName['imageColumn'] != "") { ?>
<delete file code>
<?php } ?>

Sign in to reply to this post

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