lpa Posted September 26, 2014 Share Posted September 26, 2014 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 More sharing options...
Martijn Geerts Posted September 26, 2014 Share Posted September 26, 2014 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. 6 Link to comment Share on other sites More sharing options...
teppo Posted September 26, 2014 Share Posted September 26, 2014 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 3 Link to comment Share on other sites More sharing options...
lpa Posted September 26, 2014 Author Share Posted September 26, 2014 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. 2 Link to comment Share on other sites More sharing options...
lpa Posted November 3, 2014 Author Share Posted November 3, 2014 Is it really so, that nobody finds this to be a problem in any case? Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted November 3, 2014 Share Posted November 3, 2014 I think you are making valid points here. Those files are often marketing information and are better saved with filenames as designed. Link to comment Share on other sites More sharing options...
teppo Posted November 3, 2014 Share Posted November 3, 2014 @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 More sharing options...
Nico Knoll Posted November 4, 2014 Share Posted November 4, 2014 Maybe ryan could implement a option for the image/file fields to disable changing the filename. (Including a little warning and the preferred way to only use [a-z,0-9,_]). 1 Link to comment Share on other sites More sharing options...
gRegor Posted June 12, 2015 Share Posted June 12, 2015 +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.GIFAlternately, is there a way in PHP to detect the file system's case-sensitivity? Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 12, 2015 Share Posted June 12, 2015 Alternately, is there a way in PHP to detect the file system's case-sensitivity? Create two files, which would collide only by case. See if the second one throws an error. Link to comment Share on other sites More sharing options...
suntrop Posted June 15, 2016 Share Posted June 15, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now