Jump to content

Why no uppercase or special characters in the attached files


lpa
 Share

Recommended Posts

I have always wondered why it is not possible to keep the name of the file uploaded to PW intact? I mean to keep at least the uppercase characters in the name and maybe some special chars too. I know [a-z,0-9,_] is clean, but today most of the systems, browsers etc can handle even spaces in the filenames.

There are situations where I would like to keep the names like they are in some other systems (with uppercase chars) or the same as they have been in the web before converting to PW?

So would it be possible to have an option for file-fieldtype to keep the names uncleaned when uploaded?

Link to comment
Share on other sites

There are some flavors of Windows/DOS that are not case sensitive when it comes to comparing filenames. So some operationg systems consider "processwire.gif", "ProcessWire.gif", "PROCESSWIRE.GIF" and "PROCESSwire.gif" to be the same filename. If PW would allow the case sensitive differences in file names you could imagine this will have consequences. Imagine this: I upload a file called 'ProcessWire.gif' on wamp installation, then I upload on the same page 'PROCESSWIRE.GIF', now 'PROCESSWIRE.GIF' overwrites 'ProcessWire.gif'.

Filenames in ProcessWire need to be used in URL's so the filenames should be compatible with the rfc3986 standaard. This leaves us with a restricted set of characters minus the uppercase characters.

  • Like 6
Link to comment
Share on other sites

There's an issue at GitHub related to filename conversions: https://github.com/ryancramerdesign/ProcessWire/issues/305. Technically this would be an IRI, no longer an URI (like Martijn pointed out above), but supporting that in the specific case of files might actually make sense.

Personally I'm more interested in supporting non-ASCII characters in filenames than uppercase/lowercase. I'm not familiar with the issues Martijn mentioned, but it would be interesting to know how widely spread they are. If they affect Windows > XP, then it's probably worth considering :)

  • Like 3
Link to comment
Share on other sites

Martijn, I know that. Even Mac, though being a unix, is not case sensitive by default. But that is not the issue. If the name is the same regardless of the case of letters, it should replace the file. I prefer the system not to touch my filenames by some algorithm, but give me the possibility to keep the uppercase letters.

By the way, I like the new addition of file replacing the file with the same name that was just introduced in the latest dev-versions, because I think it was annoying that I first had to remove the file before replacing with a new version of the same file.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

@lpa: some of us definitely do, but.. apart from waiting for Ryan to react somehow to the issue at GitHub, or hacking up a solution (and sending a PR to Ryan) there's not much more to do, I'm afraid. I'd take a closer look at this myself, but honestly haven't had much coding time lately :)

Ryan, if you're reading this: the issue is still there and still waiting for your input ;)

Link to comment
Share on other sites

  • 7 months later...

+1 for allowing original capitalization.

To avoid name collisions on Windows, the unique filename comparison could still use the lowercase filename, but append n to the original filename instead of the lowercase filename.

processwire.gif, ProcessWire.gif, and PROCESSWIRE.GIF would become:

processwire.gif, ProcessWire-1.gif, and PROCESSWIRE-2.GIF

Alternately, is there a way in PHP to detect the file system's case-sensitivity?

Link to comment
Share on other sites

  • 1 year later...

Haven't found any news on this issue, but I saw there is a setLowercase() method and $lowercase property in WireUpload.php

Does anybody know how to set it 'false' other than modifying that core file?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...