WordPress.org

Ready to get started?Download WordPress

Forums

uploads changing case of names (11 posts)

  1. muldari
    Member
    Posted 5 years ago #

    I notice that when I use the uploader, WP is changing all the letters to lower case. Can I fix that? It really won't work well as there are upper case letters in the file names and they need to stay that way.
    Thanks for any help or guidance on this!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    No. WordPress does not care what your filenames are if you use its uploader, it will change them as it sees fit, and part of that is lowercasing them.

    If you need filenames to not change, then do not use the WordPress uploader. Use FTP instead and link to those files directly.

  3. muldari
    Member
    Posted 5 years ago #

    Surely there must be a way around this. The site is for a client who will be using the uploader to set up the files then using a script to upload the updated files weekly. There must be a way to tell WP to NOT change case on file names. Anyone?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    There must be a way to tell WP to NOT change case on file names.

    Rewrite the function named wp_unique_filename in wp-includes/functions.php. That is what produces the new filename for uploaded files.

  5. muldari
    Member
    Posted 5 years ago #

    Thanks for the info on that. What I need is for WP to NOT change the filename at all. Leave the upper and lower case as well as the spaces and not replace them with dashes. If there anyone willing to do this for a fee? I wouldn't expect anyone to donate their time doing this and would willingly pay for the assistance. It's a bit over my head, unfortunately.

  6. muldari
    Member
    Posted 5 years ago #

    Anyone? If there is anyone who can made the edits to the functions for me, for pay, I'd sure appreciate it.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    What I need is for WP to NOT change the filename at all.

    Uh huh. And what happens when somebody uploads another file with the same name?

  8. muldari
    Member
    Posted 5 years ago #

    They are unique. Only one person is uploading files and they're all unique PDFs. So that's really not a problem. If this is not feasible, I'll try to teach them better naming practices. That would be my first choice, but the contact person is less than amenable to changing ANYTHING in how he does things.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Sigh. I'd rather hoped you'd see the light, but whatever. On your own head be it.

    function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) {
    return $filename;
    }

    Replace that function with this one. Now you have no safety net.

  10. muldari
    Member
    Posted 5 years ago #

    Trust me.. I DO understand. I really do.
    Difficult client + no patience = migraine for me. I cannot begin to tell you what a nightmare this client has been. *sighs wearily*

  11. muldari
    Member
    Posted 5 years ago #

    Thank you. That worked. I have the original backed up in case I can convince them it's a better way to go. But I won't hold my breath-blue face doesn't go well with red hair!

    I appreciate your assistance.

Topic Closed

This topic has been closed to new replies.

About this Topic