• A user of one of my sites just wanted to put a 130MB file up. This is larger than PHP’s max_upload setting, and I’m not at liberty to change the setting. (I’m not sure it’s a good idea to do so anyway.)

    I had the user upload a “placeholder” file, then I put the real file over it outside WordPress (via SFTP).

    This worked, but the media details page now has incorrect information. It has the file size and MIME type of the original file as uploaded, not the one that replaced it.

    First, how do I correct this?

    Second, is this the best practice for handling files larger than what a given server’s PHP upload settings will allow? (If not, what should I have done instead?)

Viewing 5 replies - 1 through 5 (of 5 total)
  • I had the user upload a “placeholder” file, then I put the real file over it outside WordPress (via SFTP).

    This worked, but the media details page now has incorrect information. It has the file size and MIME type of the original file as uploaded, not the one that replaced it.

    First, how do I correct this?

    https://www.ads-software.com/plugins/search.php?q=Add+From+Server

    note: You might first have to delete the placeholder from the Media library.

    Add_From_Server will properly register the upload in the Media Library, and that is how I handle all large uploads.
    note: Use “Current Date” to register, not file date.

    Thread Starter David E. Smith

    (@desmith)

    Installing a new plugin for a one-off seems a bit inelegant. (And in my environment, installing a new plugin involves an annoying amount of paperwork.) But I’ll keep that in mind, should this come up again in the future.

    In the meantime, is there a way simply to force WordPress to re-evaluate an existing upload, to get the correct MIME type and file size?

    Installing a new plugin for a one-off seems a bit inelegant.

    Your thread title had said files, not file. ??

    (And in my environment, installing a new plugin involves an annoying amount of paperwork.)

    all of that will be much less work than this:

    …is there a way simply to force WordPress to re-evaluate an existing upload, to get the correct MIME type and file size?

    I keep Add_From_Server deactivated most of the time, then spend just a minute registering a large file after an SFTP upload. There *might* be other Media Manager plugins that can do what you need, but then you are still left with getting one installed. Another option might be to look at Add_From_Server and try to figure out how it works and then do that manually (database modification), but then you are back to a lot of work for a one-off.

    Thread Starter David E. Smith

    (@desmith)

    At a glance, “Add From Server” appears to just use native WordPress stuff for adding the local file to the media library. So the information is added correctly the first time. I don’t immediately see any references in the code to fixing broken/incorrect uploads.

    Either nobody else has ever had this problem before (wanting to fix the metadata for non-image files), or it’s Really Hard to solve. ??

    I’m going to make a copy of this site on a test server, and make sure I can delete the WordPress entity and re-create it without breaking anything else on the site. (I’m pretty sure nobody is using the media page.)

    I think in the future, I’ll just have the system owners send me the files out-of-band, and I’ll import them myself with wp-cli or something.

    At a glance, “Add From Server” appears to just use native WordPress stuff for adding the local file to the media library. So the information is added correctly the first time. I don’t immediately see any references in the code to fixing broken/incorrect uploads.

    Yes, and that is why I suspect you would first have to delete the placeholder.

    Either nobody else has ever had this problem before (wanting to fix the metadata for non-image files), or it’s Really Hard to solve. ??

    I am guessing hard-to-solve, but maybe you will discover otherwise!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best way to handle LARGE files?’ is closed to new replies.