Instructional Module W50a

Web File Names

Background: W20c | Related modules | Module Home | Related Exercise: W55h | Next reading: W50b

to Top Overview

The World Wide Web is made up of many different types of computers, using different operating systems. In order to access files on a variety of computers, we need to use names that are acceptable on all of them.

This means we're reduced to the "lowest common denominator" of file names - simple names avoiding characters (letters, numbers, and symbols) that have special meanings on certain computer systems.

In this module, we'll also discuss "special" file names on the Web - names that are used for specific, predefined purposes. And we'll discuss the file extensions, the 3 or 4 letter abbreviations at the end of the name like htm or jpeg.


to Top Web Naming Rules
Yes - Use These
to Top
Link to Top

You can use:

  • alphabetic characters abcdefghijklmnopqrstuvwxyz
  • numeric characters 0123456789
  • the dash -
  • the underscore _
  • the dot . (or period) to separate the main part of the name from the extension.
Maybe - Be Careful!
to Top
Link to Top

Keep your names under about ten characters in length. You can usually get away with more, but it's better to keep it simple, and the longer it gets the more likely a computer somewhere on the Internet will choke!

Notice that capital letters don't appear in the list above. You can use them, but unless you're careful, they can cause a lot of confusion.

Why? Because some computers are case-sensitive and others aren't.

  • On case-sensitive systems, like Macintosh OS-X, Unix and Linux, these names are all different:
    home | Home | HOME
  • On case-insensitive systems, like DOS, Windows, and Macintosh OS-1 through OS9, these names are all the same:
    home = Home = HOME

Bottom line:

To keep your life simple, avoid capital letters.

Caution: Capital letters can be a problem with MS Windows. Although Windows doesn't care about capitals vs. lowercase letters when it looks for files, it sometimes automatically capitalizes the first letter of a file's name when it saves the file for the first time! This can cause much frustration when you create links using lowercase letters. They work just fine when you test them on your Windows computer, but you find that on the server the links no longer work!

To avoid this problem, check the names of Web files and graphics on your computer using Windows Explorer or My Computer. If you find a file with a capital letter, click the name twice slowly to edit it, and change the capitals to lower case. Once changed, they (generally) stay that way.

No - Avoid These!

to Top
Link to Top

There are thousands of symbols available for writing inside files, but they should all be avoided in Web file names. The only two symbols you can use with confidence are the dash and the underscore shown above.

The biggest trouble-maker is the space character. This character is OK on some systems but not on others, so the best thing to do is:

Just Say NO to SPACES!
in Web file names


 
to Top Special Names on the Web
The Home Page

to Top
Link to Top

The home page can have any of these names:

  • index.htm 
  • index.html
  • default.htm
  • default.html
What does "being a home page" mean?

A Web server is often given a URL with only a server name or a directory name, for example:

www.wccnet.org
www.wccnet.org/dept/cis/
The designers of the Web needed to give servers something to look for when this happens; so servers are programmed to look in the directory and give you any of these four files they can find. 

What if the server can't find any of these, but the directory exists? It's then programmed to give you a directory listing of the files in that directory; it's even linked so users can click on any listed file or directory and get it on their screen! But as a Web site designer, you will probably want to avoid giving your guests a directory list! It's rather like coming to an apartment building and finding a locked door with a row of labeled buttons to push. You hope someone is home! 

On the Web, it's much nicer to enter by a well-designed and attractive home page!

Note: in class, your instructor may ask you not to create a file with the name index or default. This is so your directory structure is available for inspection and to help you debug your assignments.

Extensions

to Top
Link to Top

The extension is the part of a file name after the dot. It indicates what type of file the name belongs to. On most computer systems, the extension is used by the software decide how to process a file.

The common extensions for (X)HTML Web files are .htm and .html. For simplicity, always use one or the other; shorter is better!

Common Extensions found on Web files
Extensions Type of File
htm html XHTML or HTML text files
txt plain text file
gif Graphic Interchange Format image files
jpeg jpe jpg Joint Photographic Experts Group image files
asp Active Server Pages - Microsoft dynamic HTML text file
psp PSP - open-source dynamic HTML text file
jsp Java Server Pages - Sun Microsystems dynamic HTML text file
swf Flash - Macromedia vector animation dynamic system
cfm Cold Fusion - Macromedia dynamic HTML text file
svg Scalable Vector Graphics - XML-based image as text file
How Windows' Simplicity makes life complicated

MS Windows provides two similar tools for organizing your files: "My Computer" and "Windows Explorer" (not the same as "Internet Explorer"!).

Using off-the-shelf Windows, these two tools both hide file name extensions, but show icons related to the types of files. Presumably this is done to simplify the life of beginning computer users.

Problem: when Web developers refer to a file with a link or image tag, they must know the extension - not just what type of file it is. So the "simplicity" of Windows' tools makes your life difficult. This is particularly true for HTML and JPEG files, whose extensions have more than one possible spelling.

Solution: in either "My Computer" or "Windows Explorer", select the Tools menu's Folder Options... (see Figure 1).

Figure 1: Tools Menu
Figure 1

In the Folder Options dialog box, click the View tab.

In the Advanced Settings window, click to un-check the option, "Hide file extensions for known file types."

Figure 2: Folder Options dialog
Figure 2
Recommendations for Web developers using Windows:
  • Use "Windows Explorer" rather than "My Computer": it has a folder-tree diagram which can help you visualize where your files are in relation to one another.
  • View files in details-view: you can see the sizes and creation dates, and sort on them to locate files that are either recent or old, large or small. (In Windows XP, thumbnail-view can also be helpful for visually locating files.)

to Top About This Document
Link to Review
Click here for review questions related to this module's objectives (shared with W50b and W50c).
Audience

to Top
Link to Top

This module is for people who are familiar with computers and file naming conventions in general, but need to know about rules and guidelines for naming files on the Web.

Objectives

On successful completion of this module, you will be able to:

  1. Discuss the reasons for Web file naming restrictions;
  2. List the characters that are safe to use in Web file names;
  3. List characters that are allowable on many modern computer systems but not on the Web;
  4. Discuss guidelines for the length of file names on the Web.
  5. List names that have special meanings on the Web, and discuss how to use them.
Link to Top
Module W50a: Web File Names
This document is part of a modular instruction series in Computer Instruction. For more information, see the overview or the list of modules in this series, W: World Wide Web. This document has been used in the following classes: INP 150.
History
Original: 02 June 2004, by Laurence J. Krieg
Last modification: Monday, 31-Aug-2009 11:48:06 EDT
Copyright
Copyright © 2004, Laurence J. Krieg, Washtenaw Community College
Instructors: You may point to this file in your Web-based materials; however, its location may change without notice.
Students: You are welcome to make a copy for your personal use.
All other uses: Please contact the author, Laurence J. Krieg, for permission: krieg@ieee.org.
Background: W20c | Related modules | Module Home | Related Exercise: W55h | Next reading: W50b

Link to Top