Unable to upload a directory

OpenEMR 702 on Linux Mint 21.3.

I am unable to upload a directory containing MRI images.

I click ‘Documents’, I select the openemr directory to which I want the upload to go, I click the lower ‘Browse’ button and select the directory I want to upload, I then click ‘Upload’ and… Nothing happens. I wait, I wait. Nothing happens.

Am I missing something or is this a bug?

Thank you.

Can anybody help? Much appreciated.

Could be wrong but I believe OpenEMR only handles discrete files, not directories/ folders. You can compress a directory into a .tar or .zip file and upload that, but not the collection of files as a directory.
Best- HT

Thanks HT, I think you are correct, but I did actually zip the directory and it wouldn’t upload. No error message either.

Ok-well-- looks like a more complicated issue than just file upload incompatibilities and you’d need to give more information.

What file type are they, DICOM?

Can you upload a single image file to some arbitrary directory in a patient’s Document tree? In order to have them grouped as desired you may need to create a new directory in the patient’s Documents tree named the same as the one they came from. Then upload the individual files to each new directory.

Did you try simply zipping the individual files into an archive and uploading that zip file? I.e., don’t try to upload the directory itself.

This thread in particular, talks about php dependencies and MIME whitelisting.

A search of this forum
https://community.open-emr.org/search?q=file%20upload

brings several results, any of them ring a bell?
Best- Harley

Hello again,

Yes, they are DICOM images.

Yes, I can upload single image files. But it would be very time consuming to upload all of the images from an MRI study one at a time.

The functionality of the directory upload feature does not allow you to select a zip file to upload. It asks you to select a directory, which it will then zip for you for upload. But it does not work.

I did not understand much of what was written about php dependencies and MIME whitelisting in the thread you mentioned. I do not know how to check whether I have php_fileinfo installed and enabled. In Admin->System->Files I have no whitelist or blacklist.

I cannot find any thread corresponding to this issue in the forum search.

hi @rdh61 , check your php error log to make sure that the php.ini settings post_max_size and max_file_uploads are large enough after your upload fails.

Hi Stephen, while I cannot locate my php error log (Google tells me it should be at /var/log/apache2 but there is no apache2 directory in /var/log), php.ini does set a very low maximum file size upload (2M). Nevertheless, uploading of a directory fails even if the size of the directory is well below this (e.g. 1.4M).

Correction to previous post: There is an error message that appears on the document upload window (I must have missed it before). Rather inexplicably, it tells me: " Error number: occurred while uploading file named: DicomStudy.zip The system does not permit uploading files of with size 0".

if ($_FILES['file']['error'][$key] > 0 || empty($fname) || $_FILES['file']['size'][$key] == 0) {
                    $fname = $value;
                    if (empty($fname)) {
                        $fname = htmlentities("<empty>");
                    }
                    $error = xl("Error number") . ": " . $_FILES['file']['error'][$key] . " " . xl("occurred while uploading file named") . ": " . $fname . "\n";
                    if ($_FILES['file']['size'][$key] == 0) {
                        $error .= xl("The system does not permit uploading files of with size 0.") . "\n";
                    }
                }

Check the dir you’re uploading for non dicom or subdirectories etc.
I think I also allowed you to upload a zipped file of images but I do validate the zip for several attributes including DICM appears in header.
Take note that if you upload a zip it runs through same validation as when I zip directory for you!

I sent out a warning several times letting people know that the viewer needs serious upgrades. It’s been a couple years since I created this feature and this is first issue I’ve seen in long while so I’ve no clue how or if it is being used.

It’s up to the community if they want this feature or not. I know I made a considerable effort to provide it!

If you get me a zip of study I’ll take a look…

Thank you Jerry, I’ll get back onto it tomorrow.

easiest path is to unzip the dicom zip file and then select the folder that has the dicom images to upload @rdh,
Screenshot from 2024-04-01 14-52-51

found a sample dicom zip that’s good for testing with the DICOM folder in this example

My understanding he is uploading a directory.
He can upload a zip of dicom files(study) as if a normal file upload. I look for such and open to validate all files in zip the store as normal if all files pass. Otherwise error is shown.
The reason for zip is they load very much faster in the viewer.

I think the browser tries to d/l the zip file instead of sending it to the dicom viewer?

Probably need to adjust browser settings.
When I left off developing this project there were some bugs in viewer library concerning if/how some images are rendered in viewer. It needs refactor and update!

Uploaded zip of study

Directory of 22 images in a study upload

What’s nice is the separate viewer at Miscellaneous->Dicom Viewer of which I’m a little bit proud.
From it you can independently upload zips’, directory or image from drive.

This is one of many contribution I’ve made over the years to OpenEMR of which we are no better off today with community folks stepping up and help support the ongoing effort all of us Admins have to put in trying to keep up with ever changing requirements of all our great features, as we were 7 years ago.
We are struggling with advancing current new features(Assessments/Questionnaires and Modules) that have been adopted or co-opted but see no community support.

Sorry Robert to rant here but you will find me doing this occasionally elsewhere in hope folks reading on forum will feel my pain! Not directed at you.

Thank you for that. I tried to upload this sample in two different ways. First I extracted the folder and tried to upload with the lower of the two “Browse” buttons (“Select below to Zip Directory of image slices”). Then tried to upload the original zipped folder with the upper of the two buttons. Both methods failed with no error messages displayed.

I also rechecked php.ini and found that max_file_uploads = 20, which is way too few for a DICOM MRI study. I edited it to 800 and rebooted before trying again both with your sample study and my actual study. Still no joy.

Link to zipped directory sent to your inbox. Many thanks.

What does d/l mean, please?

We all need a good rant now and again! Your contributions and those of the other developers and contributors is much appreciated. What kind of support are you needing?

By the way, I’m using the Docker version, if that makes any difference.

hi @rdh61, you have to change the values mentioned above in the docker php.ini.

1 Like