close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete file from server

Thread began 4/25/2013 3:48 am by CraigR | Last modified 4/25/2013 9:21 am by Jason Byrnes | 2045 views | 9 replies |

CraigRBeta Tester

Delete file from server

I have a dataassist type results page for uploaded pdf documents, and on the tabular data I have a delete button on each row.

On click, this populates the WADADeleteRecordID hidden field and launches the delete popup. - works fine.

On deletion, I also want to remove the file itself, as well as the database record, so I added the delete file server behavior

I have edited the onclick behavior of the button so that it also sets the value of a new hidden field WADADeleteFileName with the filename from the recordset, but it will not populate the field.

page attached

Attached Files
upload.zip
Sign in to reply to this post

Christopher WestCommunity Expert

Have you tried deleting the file first before the record?

Sign in to reply to this post

CraigRBeta Tester

Hi Chris.

It isn;t the order which is causing me the issue.

If I change the hidden fields to text fields, I can see that the UploadID box is updated from the onclick event, but the FileName is not.

Sign in to reply to this post

Jason ByrnesWebAssist

in the onclick event you are using the Description column:

document.getElementById('WADADeleteFileName').value=<?php echo ($row_rsuploads['Description']); ?>;



shouldn't that use the File Name column?

document.getElementById('WADADeleteFileName').value=<?php echo ($row_rsuploads['DocumentFileName']); ?>;
Sign in to reply to this post

CraigRBeta Tester

Yes, it should, I tried documentfilename, then description because I couldn't get documentfilename to work.

Strange thing I discovered, if the description field is numerical, it copies Ok, if it contains any alpha characters, it doesn't !

Sign in to reply to this post

Jason ByrnesWebAssist

since there aren't any quotes around the value being passed, it is assumed by JS to be numeric.

change:

document.getElementById('WADADeleteFileName').value=<?php echo ($row_rsuploads['DocumentFileName']); ?>;



to:

document.getElementById('WADADeleteFileName').value='<?php echo ($row_rsuploads['DocumentFileName']); ?>';
Sign in to reply to this post

CraigRBeta Tester

That's it.

Without the quotes, it fails, with the quotes it works !

Thanks Jason

Sign in to reply to this post

Jason ByrnesWebAssist

yeah, when using a text for a variable in JS (PHP too) you need to include quotes:

JS:

var foo = 'bar';



PHP

php:
$foo = 'bar';



no quotes are needed when using a numeric value:
JS:

var foo = 123';



PHP

php:
$foo = 123;
Sign in to reply to this post

CraigRBeta Tester

oops, meant to give 5 stars, but can't edit the rating.

Sign in to reply to this post

Jason ByrnesWebAssist

That's OK, I'll take 4 1/2 ;)

Sign in to reply to this post
loading

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