Welcome to WebmasterWorld Guest from 54.226.143.14

Forum Moderators: incrediBILL

Message Too Old, No Replies

spaces ok in image names?

   
5:37 am on May 19, 2011 (gmt 0)

5+ Year Member



My assistant uploaded to the file server some images with names like "image name 1.jpg" containing spaces. She then added the images to a webpage using the <img src=> tag. I always thought spaces were not allowed in file names.

But then, I viewed the web page with browsershots.org and every browser that could show the image did show the image. Are there any reasons for not using a space in an image file name?
7:30 am on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Some browsers will treat the spaces as spaces. Some will collapse them. Some will demand that you express them as %20. Better to play it safe and stick with alphanumerics-- case sensitive-- and lowlines.
8:20 am on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



or hyphens...

Meanwhile, would not suggest spaces at anytime...
6:23 pm on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Spaces never used to resolve, on servers, some operating sysyems, or browsers, for file names (who remembers the 8/3 rule? :-) ) Both have gotten pretty good at resolving it, but I encountered something just the other day that says it's still unsafe practice.

I am setting up a CMS for a client. They were playing with it, and sure enough - A "File Name Is like a small text editor, right.jpg" comes along. The CMS encodes the file name to make it database safe and you get a literal File%20Name%20Is%20like%20a%20small%20text%20editor,%20right.jpg for a file name in the database.

Spaces still cause problems, as does CaseSensiTivity. Form a standard with files, something other people do so if you ever call someone in they will do the same thing. Lower case and no spaces for file names. Underscores lead to underscores in published files, and that's not a good habit to form* (though it's not a death knoll, dashes are better.)

(*I know. I'm guilty of it.)
6:40 pm on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I just ran into a spaces-in-filename indexing problem with a major client site on Tuesday. Completely agree - for online file names, avoid using the space character 100%.
6:41 pm on May 19, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



who remembers the 8/3 rule?

It is so ingrained here that I have never been able to bring myself to use the .html extension (which simply didn't work on my first computer).

Another reason not to use spaces is that if you ever need to redirect the URL it is a nuisance.

...
12:18 pm on Jun 2, 2011 (gmt 0)



Spaces within image names, I would not recommend. Use hyphens or just use no spaces at all. It will not hurt you to do without the space.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month