1

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.

  • 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
5

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

  • 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 de Bernardy Jan 27 '11 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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