Problem/Motivation
Some hospital pricing files are huge. I am trying to use this on a site where the file is 520MB, but the hosting provider only allows uploads of up to 256MB. This is a huge problem because the regulations say that the pricing must be in a SINGLE machine readable file.
Proposed resolution
Here’s what I’m thinking. Drupal has this Zip class for dealing with this stuff. I want to add a field widget that extends the normal file widget to allow a zipped version of any of the configured file formats (per a config option). If a zip is uploaded, the widget would test that it’s (a) a single file in the zip and (b) the file has an allowed type. If everything is above board, it would extract and then let everything proceed as usual. This is all theoretical, but it seems pretty straightforward.
Add a validation constraint that, if a zip is uploaded, forces it to be a single archived file of one of the other allowed types. (Relying on the field widget would be less robust). Then on a preSave, extract the archived file into a new file entity and have the hpt reference that new file. The zip ends up being left as a temporary file.
User interface changes
API changes
zips can work well
Data model changes
zips can work well
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | hpt-zips-3374405-2.patch | 14.78 KB | danflanagan8 |
Comments
Comment #2
danflanagan8Here's a patch that seems to work and has a reasonable amount of test coverage. I'm not confident there aren't bugs or security concerns lurking in here though.
In my manual testing I was able to upload an xml file that zipped to 25MB and extracted into a 500MB file. The system has a max upload of 100MB. Unfortunately, memory was getting exhausted while trying to serve the contents of the file from the HPT controller. That was resolved by refactoring the controller a bit. But it may be that some files (1GB?) are way too big for even that refactored approach.
Comment #3
danflanagan8Ah, the patch won't apply here because it has some zip files included for use in the tests.
The tests pass locally. And if committed, there won't be any trouble running tests on d.o. I had this problem with the crossword module a few times.
Comment #5
danflanagan8Comment #7
danflanagan8