Documents don't upload

rdh61 wrote on Friday, February 10, 2012:

Hi,

Version 4.1 on ubuntu 10.10 and firefox.

I have one patient on my database for whom no documents will upload. The same documents will upload successfully for other patients on the database.

Very odd. I have no idea what to do about it.

Any help gratefully received.

aethelwulffe wrote on Friday, February 10, 2012:

open patient,
go to admin/ practice/ documents,  update files….see if that does anything. (dunno if this really works!  Looks like it should update the files……)

Look at the patient’s documents, note what is supposed to be there.  Look at openemr/sites/default/documents/PID#, see if it is any different.  If there is no directory for that PID, or something is funny, you got a problem.  Possibly someone has played with those files.  You should not (ever) manipulate those files directly.

There are other things to check, but this is a quick easy start.

rdh61 wrote on Saturday, February 11, 2012:

(1) admin/practice/documents/update files didn’t do anything to change the situation.

(2) Patient’s PID# directory and document files are present at openemr/sites/default/documents.

(3) On further investigation I found that I could only successfully upload new documents for patients entered to the database AFTER upgrading from version 3.2.

(4) For patients entered entered to the database BEFORE upgrading from version 3.2, I can neither upload new documents (no error message - just doesn’t work), nor open documents listed as present, even though they are present at openemr/sites/default/documents/PID#.

(5) In this latter case, the error message is: The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it. /var/www/openemr/documents/PID#/document_name.odt

So, it seems that openemr is looking for the documents using the wrong path. How can I correct this?

Thanks.

bradymiller wrote on Saturday, February 11, 2012:

Hi,

The path thing has been dealt with (the change in paths to documents from 3.2 to 4.0), so this shouldn’t be causing problems. Is the error showing on the screen or in the php error log? The fact that you can’t upload new docs along with view them makes me think there is a permission issue? What is the operating system that you are using? Do you note any permission differences between the directories of the pre-upgrade patients and post-upgrade patients?

-brady

rdh61 wrote on Saturday, February 11, 2012:

1) The message “The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it. /var/www/openemr/documents/PID#/document_name.odt” appears on the screen when I try to upload a document. I understand though that the path should be: openemr/sites/default/documents, not openemr/documents. (??)

2) OS = ubuntu 10.04. (I said 10.10 above, a mistake).

3) Pre-upgrade files’ owner is given as “root”. Post-upgrade files’ owner is given as “www-data”.

bradymiller wrote on Saturday, February 11, 2012:

Yep,

This is a permissions error. Make the owner of all of the files in your documents directory to be www-data (this is the apache server, so will give it permission to place new files and view files in all directories).

sudo chown -R www-data:www-data /var/www/openemr/sites/default/documents

-brady

rdh61 wrote on Saturday, February 11, 2012:

Yes, that worked. I can now upload and view documents for all patients. Many thanks.

tmccormi wrote on Saturday, February 11, 2012:

That does bring up the fact the error message is invalid and misleading, the displayed path is not the one that it was having trouble with, it is the OLD path format…
-Tony

mwestrik wrote on Wednesday, February 05, 2014:

I realize this is an old topic, but i do have the same problem now, all of a sudden. It has worked all the time, but not anymore since recently.

Uploading the files through the website seems to work, the status indicator goes from 1 to 100%, but after that nothing. Checking the dir shows the file isnt there.
Copying the files manually into the patients directory doesnt help either. They will appear in the dir, but not on the website. Old previously uploaded files are still visible though.

what can be the cause of the uploads all of a sudden not working anymore? Maybe a php update on the server?

we’re running OpenEMR version 4.1.0 (7)

mwestrik wrote on Wednesday, February 05, 2014:

some possibly helpful additional information: the server is now running:

Apache-version 2.2.22
PHP-version 5.2.17

yehster wrote on Wednesday, February 05, 2014:

Did you try changing the directory permissions as described in an earlier message in the thread?

mwestrik wrote on Wednesday, February 05, 2014:

when doing it, I only get:

chown: invalid user: `www-data:www-data’

yehster wrote on Wednesday, February 05, 2014:

Suggests to me that either your system is configured to run apache with a different user account than www-data or something got corrupted with the user accounts on your system.

mwestrik wrote on Thursday, February 06, 2014:

already contacted the host, they couldn’t or wouldn’t help me with that.

mwestrik wrote on Thursday, February 06, 2014:

well, I have succeeded in changing the permissions. for the record: www-data is the user on Ubuntu machines. For CentoS machines, that user is apache.

But still, the problem stays the same.

mwestrik wrote on Wednesday, February 12, 2014:

in fact, it has become worse now. since I’ve done what you said I do get these errors when uploading:

Warning: mkdir() [function.mkdir]: Permission denied in /home/clinical/public_html/controllers/C_Document.class.php on line 91

Warning: move_uploaded_file(/home/clinical/public_html/sites/default/documents/40/paspoort.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/clinical/public_html/controllers/C_Document.class.php on line 117

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpWF6jAW’ to ‘/home/clinical/public_html/sites/default/documents/40/paspoort.jpg’ in /home/clinical/public_html/controllers/C_Document.class.php on line 117

yehster wrote on Wednesday, February 12, 2014:

It still seems like a problem with permissions, to me, but I’ll defer to someone else with more experience with CentOS, given that I’ve led you astray so far.