homepage Welcome to WebmasterWorld Guest from 23.23.12.202
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
spaces ok in image names?
leafgreen

5+ Year Member



 
Msg#: 4314501 posted 5:37 am on May 19, 2011 (gmt 0)

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?

 

lucy24

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



 
Msg#: 4314501 posted 7:30 am on May 19, 2011 (gmt 0)

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.

tangor

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



 
Msg#: 4314501 posted 8:20 am on May 19, 2011 (gmt 0)

or hyphens...

Meanwhile, would not suggest spaces at anytime...

rocknbil

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



 
Msg#: 4314501 posted 6:23 pm on May 19, 2011 (gmt 0)

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.)

tedster

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



 
Msg#: 4314501 posted 6:40 pm on May 19, 2011 (gmt 0)

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%.

Samizdata

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4314501 posted 6:41 pm on May 19, 2011 (gmt 0)

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.

...

KwikDrySystems



 
Msg#: 4314501 posted 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved