Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to upload a PDF file with spaces in it, and I want to do this using the uploader in the rich text editor (really, I want other, less savvy people to be able to do it, so convoluted workarounds are not really an option). Trouble is, Wordpress (3.0.3) insists on replacing spaces with hyphens and lowercasing everything (despite the fact that it's just not necessary).

Can I stop this? Turn it off? Or is there an extension to thwart this behaviour? Even a manual edit to the PHP might be okay, if there's no alternative.

share|improve this question
3  
"despite the fact that it's just not necessary" ... Google "File naming conventions" and you'll get a better idea of why filenames are converted. –  t31os Dec 14 '10 at 20:00
    
I suppose that I have the luxury of using Wordpress on one particular server, but the authors want it to work on all of them, so yes, maybe I am being too harsh. Still, changing my metadata to fit the lowest common denominator is annoying. –  detly Dec 15 '10 at 0:16
add comment

1 Answer

up vote 5 down vote accepted

"despite the fact that it's just not necessary"

I think you'd be surprised by how unnecessary looking stuff has a tendency of becoming absolutely necessary on some poorly configured servers.

Else yes, it can be overridden using filters. You're looking into overriding the stuff in sanitize_file_name(), which is located in wp-includes/formatting.php.

share|improve this answer
    
Sorry for the delay :/ When you say "overridden using filters," what do you mean exactly? There's an alternative to hacking on the source? –  detly Jan 26 '11 at 17:41
    
sanitize_file_name() ends with a filter call, which allows you to completely override the functionality. –  Denis Jan 27 '11 at 14:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.