Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1055939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:38:32+00:00 2026-05-16T17:38:32+00:00

What function in Drupal gets file attachment path? Edit: the attachments provided by Upload

  • 0

What function in Drupal gets file attachment path?

Edit: the attachments provided by Upload module in system section. But since you mentioned there may be another way around it. Maybe I could achieve may goals using FileField module so if you could tell me how to get a direct link of a file uploaded by FileField module that may also be very helpful.

Edit 2:
Ok I will start from my main and final objective:

It is to get an image linking to a file which visibility I could be managed using CCK module.

I am doing this step by step. So now I have written a code which generates the needed image and I have added that image to one of content types teaser. I found a way to warp my image in a tag and I had dug up simple attachments url. So my next step is to advance from simple upload attachment to the one added by FileFields and from odd looking HTML pace in all PHP document into beautifully managed CCK field.

  • How to fetch file path of a file uploaded FileFields?
  • Some plain and at the same time rich tutorials for making custom fields for CCK module.
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:38:32+00:00Added an answer on May 16, 2026 at 5:38 pm

    Assuming you know how to get the $node object for a node containing a file attachment, this is super easy:


    Upload (core)

    $file = upload_load($node);
    echo $file[1]->filepath;
    

    Where 1 is the index of the file. Upload can let you upload more than one file, so file 2 would have an index of 2 and so on. If there’s only one file, it’ll always be 1.

    • More info: upload_load() API reference.

    FileField

    echo $node->field_fieldname[0]['filepath'];
    

    Where field_filename is the short name you’ve used for the field, and 0 is the index of the field. CCK fields let you have multiple values in one field, so 0 would be the first, 1 would be the second, etc. If you only have one value, it’ll always be 0.

    Note: if you want to get the rendered output of the FileField using its formatters, you can just use $field_fieldname in your node template, or if you want to store the rendered output, you can use:

    echo content_format('field_fieldname', $node->field_fieldname[0]);
    
    • More info: content_format() API reference.

    Upload is a sad little module, and has been completely replaced with a core implementation of FileField in Drupal 7. If you have the option to use FileField, you should.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP function in a Drupal 6 .module file. I am attempting
So I have the following function in my drupal module. I want to submit
Is there any function in Drupal like get_module_info('MODULE_NAME') or I should parse info file?
I've created a hook submit function for my Drupal node edit form. I'd like
t() is an extremely useful function in drupal but I can't figure out how
Drupal doesn't call my theme function for my form in my module. I added
What is the function used to create taxonomy terms in Drupal from the code?
Are there any Drupal IDE's with syntax highlighting, and possibly intellisense, function descriptors?
I have hourly weather data. I've seen the function examples from here: http://casoilresource.lawr.ucdavis.edu/drupal/node/991 I'm
I have a custom form implemented in a custom module in drupal 6. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.