This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

help needed with an SQL statement: returning the path and filename of a file(s) attached to a node

Hi Guys,

Need some help with an SQL statement. What I would like to is:

1. Check to see if a node has an attachment.

2. If the node does have an attached file, Return the filepath and filename in such a way I can assign a variable to each.

As far as I can see from the upload.module. this is the sQL that checks and loads the node attachments. What I need help with is the end of this snippet...i.e. after building the list of attachments..I would like to assign those to variables....i.e.

$att1="/full/file/path/and/filename.one"
$att2="/full/file/path/and/filename.two" etc.

But my php skills are limited and I'm not sure how to do that.

Anyone got any tips?

if ($node->files && user_access('view uploaded files')) {
        $header = array(t('Attachment'), t('Size'));
        $rows = array();
        $previews = array();

        // Build list of attached files
        foreach ($node->files as $file) {
          if ($file->list) {
            $rows[] = array(
              '<a href="/'. ($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path()))) . '">'. $file->filename .'</a>',
              format_size($file->filesize)
            );
            // We save the list of files still in preview for later
            if (!$file->fid) {
              $previews[] = $file;
            }
}

Dub..

Problems attaching a flexinode with attached node

I filed a support request with the attached node project page, but I thought this problem might have been produced from my own ignorance (not necessarily the module itself), so I'll post this issue to the wider forum groups in case someone has a workaround or can explain what I've overlooked.

E-Commerce - paid subscriptions

I would like to set up a paid subscription service similar to that at http://wpacouncil.org/ using Drupal and the E-Commerce module. However I don't seem to be able to find any documentation that shows how such a system can be set up.
I have found numerous references to such a setup, but have not been able to find a guide, or any post that actually tells you how to set it up.

hook_user: can't save custom data on insert op

I want to save custom data in user.data table when a new account is created, but after all, i can't do it and there isn't information out there about it.

Do you know what is the way of achieving this?

How to open new Windows in aggregator.module ?

How to open new Windows in aggregator.module ?

flexinode date field

i am tring to use datefield
but it display the year start from 2000!!!

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions