Making Images and Other Files Available

In addition to the text content that you put into your site, you'll want to make files available to the site: graphics to appear in your nodes or as logos, documents that visitors can download, etc. Here's a quick look at where these files live on the web server, and how you place files there:

Your site's file system

All the special files that run your Drupal site live on a web server that you may or may not have administrator access to. Your site directory on that server holds a configuration file, themes, and other bits specific to your site.

In a typical setup, there's also a directory within your site directory that's used for holding uploaded files. It'll often have a simple name like "files". All examples below will use "files" as the name of this directory; if the name is different in your setup, replace "files" in text below with the correct name. 

Within the "files" directory, there may be additional directories holding the actual image files and downloadable files. Each registered user with permission to upload files may also get his own directory to store files. All details will depend on how the site is set up. 

If there are user-specific directories, each will each have a unique name – for example, "u" (for user) followed by a number. In this case, the top "first user" site administrator will have a directory named "u1", while additional users will have directories named "u2", "u3", and so on.

That's the overview, and you generally don't need to worry about it at all. But if you're interested in the following, it's useful background.

Built-in file browser

A file browser is an interface for listing and working with directories and files stored on a computer. You may have a built-in browser for your personal file directory. Check here:

Navigation » My account

If you see a tab labeled 'Personal files', 'File browser', or something similar, click that. There's your file browser. Details from there will depend on how the Drupal site was set up. To upload a file in a typical setup, you'll see a link or button with a name like 'Browse', 'Upload', or 'Choose file'. Clicking that will let you use your computer's own file browser to find and select the file to upload. You'll then click 'OK' or 'Open' as apropriate, taking you back to Drupal's file browser, where you'll click a link or but†on named 'Upload File' or something similar. That sends the file to the server, after which it should appear in the list of files your file browser displays, and will be available for use later.

Uploading files

Placing an image file into text

How do you place photos or other images inside text, such as in a node or block's Body field? If you're keen on writing HTML code, that's of course one option: write the code into the text that gives Drupal the URL of the image to display (it doesn't even have to be on your server) and the parameters for displaying it how you like. 

Most users are looking for something far different, though. Typically, a site will use a "WYSIWYG" ("What You See Is What You Get") text editor that lets you style text in word-processor fashion; said editor will include a button that calls up an image editor, a tool for selecting and inserting images into the text.

Drupal has no built-in image editor, so what's available depends on how the site was set up. Many sites will add an image editor which will not only let you choose an image on your server to insert into a node, but also let you upload new images from your computer to the server, using a file browser like that described above, or using a separate, specialized image browser.  

The topics of editing text and inserting images into text are covered in Using Text and Image Editors.

Attaching a file to a node for download

Assuming your site is set up for attaching downloadable files to nodes, the process is mentioned in Create a Page Node.

There's little to say, though. Your setup likely offers two choices:

a) If the file is already on the server, input its address.

If it's a file you've uploaded via a file browser, it'll likely be in your personal file directory. For example, if your personal directory is "u1" and the target file is "downloadfile.pdf", then input files/u1/downloadfile.pdf .

Or:

b) Use the 'Browse' button to select and upload a file from your computer.

Either way, the file will appear on your new node as a link. When a user clicks the link, his browser will initiate a download of the file.

Uploading logo files

This is described here in Configuring Your Theme.

Drupal lets a Theme specify where and how to display a special logo file. The way you and Drupal will handle this file, however, differs from handling image files as described above.

The Themes configuration form gives you a field to enter the logo file's address, or a button to upload a logo file; it doesn't give you access to the above file browser or image editor. You have two choices from the Themes configuration form:

a) If the logo file is already on the server, input its address.

If it's a file you've earlier uploaded via a file browser, it'll likely be in your personal file directory. For example, if your personal directory is "u1" and the target file "logofile.gif" is inside there, then input files/u1/logofile.gif .

Or:

b) Use the 'Browse' button to select and upload a logo file from your computer.

However, whichever of the above methods you chose, Drupal insists on its own name and place for that logo file. It will automatically create a logo file in the "files" directory, not your personal directory, and will give that file its own fixed name. (That shouldn't matter to you, but is useful to keep in mind if you need to troubleshoot logo problems.)

You can switch to a different logo file at any time, of course. Just specify a new one per a) or upload a new one per b).

Access by FTP

If you want to upload many files, your file browser may limit you to one file at a time. It'd be easier to upload them in bulk via FTP. However, if the site lives on a hosting company account not held by you, you may not have permission to access directories in the web server structure via FTP. That's good for security, if somewhat inconvenient for anyone wanting to upload many files at once.

Contact the holder of the hosting account if you need to make a bulk transfer of files to your site directory.

Comments

Unknown Drupaloid's picture

I wonder if it's possible to have a set of images (say 30-60) and have these images connected randomally to nodes, so that each and every node is associated with an image of that set.

cheers !

Add new comment