3

This was and is working fine in my local environment, but when its on the server (hosted by Justhostme) I get this error whenever I try to upload a new image to a node. I've seen advice that it could be my temp directory so I've changed this and set 777 permissions on it. I'm very stuck with this now. I'm not getting any more error message so nothing to hint at what else it could be.

heres hoping.

Edit. I've checked the logs, and these 3 messages appears when I try to upload. The refered to folder has 777 access too. Msg 1.

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access public://field/image/leaflet_front.jpg in file_save_upload() (line 1541 of /home/xxx/public_html/includes/file.inc).

msg2

Upload error. Could not move uploaded file leaflet_front.jpg to destination public://field/image/leaflet_front.jpg.

msg 3

The file upload failed. field_image_und_0
3

There is a long thread in the Drupal.org site surrounding this issue, I didnt locate it at first due to my error message being masked. After many hops around the net I did finally locate it, and it seems to effect quite a few people.

See this link

http://drupal.org/node/1002048

post #154 has a link to the patch for both version 7 and 8 of Drupal.

1

My site has not been moved yet, so I am speculating here. WHat have you checked so fa?. Was the image directory under your domain directory? If you edit the content and select the image name is it pointing to the correct path for the online directory? Have you spoken to your host about this?

Edit:

I just saw your edit adding the error messages and realize I missed that this was during an upload. I assume the path exists. Does the image fall within the size parameters for uploading the image?

  • Checked all the folders involved i.e. Temp which is refereced by Config>file system>temp directory. image storage folders under root/public_html/sites/default/files... I have tried setting to Private files system. I have an open ticket with my host, no luck so far. I've tried setting my tmp folder to different locations. but after seeing those error message I'm thinking it might not be the temp thats the problem? – Purplemonkey Oct 21 '11 at 15:29
  • The error message looks like it is coming from the host and not from Drupal. My Drupal error messages always include the name of the module/file that has generated the error. – Ashlar Oct 21 '11 at 15:40
  • yeah its a valid point, all my sites are suffering the same problem, and they are all with the same host. but I do wonder if its a php.ini or .htaccess thing? – Purplemonkey Oct 21 '11 at 15:52
  • just seen your edit comment, size's are all fine, I even tried removeing all. yeah the paths exist, Drupal configs will give errors when configuring if its invalid. Although I'm not sure how I can confirm the "public://files/etc..." – Purplemonkey Oct 21 '11 at 16:26
  • I have not palyed with either file much yet. Looking through .htaccess I do not see any settings that look like a culprit. – Ashlar Oct 21 '11 at 16:39
1

Need to change permission

you just need to change the permission of file folder in drupal-7.26/sites/default/

=> sudo chmod 777 -R files

  • Just make sure you don't do this in production websites. Only put this permission setting on a website that is not public. – Will Jun 7 '16 at 16:51
0

I have not played with either file much yet. Looking through .htaccess I do not see any settings that look like a culprit. I did find something in php.ini that leads to a question.

;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads. file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ;upload_tmp_dir =

; Maximum allowed size for uploaded files. upload_max_filesize = 256M


Check your settings. It may affect something. However, I am unclear about how this works on the server. I thought PHP was provided by the server so I would think they handle php.ini. Is it accessible to you? Whatever you find, please tell us in this question what happens.

  • Sidebar comment: I have no idea why the text style changed in the first paragraph of this post. – Ashlar Oct 21 '11 at 16:46
  • Where is the php.ini file located, the ones I find in my Drupal folders are pracically empty. Would be interested to try this, but I have now found a Patch in the Drupal community do resolve this issue. And although I'm no good at applying patches yet (had to manaulyl edit my files) it does appear to be working. Link - drupal.org/node/1002048. cheers. If you update me to the php.ini settings i'll test it on one of my other sites. – Purplemonkey Oct 21 '11 at 16:53
  • I added "file_uploads = On" to a php.ini files located in /public_html and unfortunatly it doesn't make any difference. would you confirm this is the correct file to use? – Purplemonkey Oct 21 '11 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.