Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Legal / Allowed characters for web server file names on?

Tags:

html

web

What characters are allowed in filenames for HTML files on ALL servers (*nix, Windows, etc.) ? I'm looking for the "lowest common denominator" that will work on all servers. USE: I'm naming a file to be served up publicly (Mysite.com/My-Page.htm)

E.g., space? _ - , etc.

E.g., can I have File-Name.htm, File_Name.htm File Name.htm?

Obviously, this needs to work with all servers and browsers. (IIRC, the name is limited by the server not the browser, but I could be wrong).

like image 628
Clay Nichols Avatar asked Sep 28 '09 17:09

Clay Nichols


People also ask

What characters are legal in file names?

Supported characters for a file name are letters, numbers, spaces, and ( ) _ - , . *Please note file names should be limited to 100 characters. Characters that are NOT supported include, but are not limited to: @ $ % & \ / : * ?

What is the character limit for a file name?

Windows can handle file names of up to 260 characters in length, including the path to the file. If a file is nested within many folders, and/or if the file has a long name, the character limit is most likely exceeded.


2 Answers

If you don't want your filenames to be encoded by the server, you should avoid reserved characters: $&+,/:;=?@ and unsafe characters: space, quotation marks, <>#%{}|\^~[]`

But as the previous answers stated, the web servers should cope with whatever you want to use by encoding the chars.

like image 154
Jim Downing Avatar answered Sep 24 '22 01:09

Jim Downing


I would say a good rule of thumb for filenames for HTML files on ALL servers can be any combination of alphabet (lowercase preferred) and number characters (1 though 9), plus the underline(_), minus(-) or plus(+) characters but no spaces. Also, end the filename with dot html (e.g. filename.html). I personally avoid using underline and plus characters.

like image 24
Mark Orlassino Avatar answered Sep 24 '22 01:09

Mark Orlassino