Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Image Gallery - upload fails to due to /tmp folder permsissions

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 3355 Views
  • redactuk
    Avatar
    Community Member
    115 Posts

    Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    I'm trying to get image_gallery to work on a client's system, but whenever client or myself upload any images they are not written to the server. Initially I noticed that even a new album folder was not being created. So I changed CHMOD on assets/image_gallery to be 777 (it was 755). Now when I add an album the folder IS created under this path BUT it's CHMOD value default to 755, and for some reason any attempt to upload images fails as they are not written to this folder.

    Now I've tried to manually change permission on newly created album folder but it won't let me (apache sees my FTP user credentials as being different to the folder's owner i.e. Silverstripe user).

    So firstly I'm confused why 755 seems to be insufficient for the image gallery upload process to write files?

    Secondly if it needs to be 777 how the hell do I get image gallery to default new album folders created to 777 to start with?

    Any help appreciated.

    Thanks

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    What makes you think it's failing due to permissions?

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    Well I'm using same version of image_gallery as on other site that works - image gallery r390 and SS 2.3.7. Also there is no error message reported, and it says image uploaded ok and you get a blank icon for each image, so it's making entry in the database, it just that no file gets written to the file system.

    Would an error be reported by your module if file could not be written?

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    Come on guys... I'm not after the moon on a stick.. someone must be able to give me some pointers?

    1. I can create any album.
    2. When I upload ANY image to that album it says its uploaded but no image is actually displayed where the rotation controls are. Also no physical file IS actually uploaded. When I close upload box there is just a blank icon instead.

    What's strange is that the path shown under where the image should be displayed in between the rotation controls on image uploaded pop-up says:

    assets/image-gallery/Kids-Realm/animal-project/new-imagegalleryimage

    The path is correct but why does it say the filename is new-imagegallery image?

    As soon as the image has uploaded at this point is should display the filename just uploaded... so at what point in image-gallery code or rather what has just had to have gone wrong for the filename to be displayed as new-imagegalleryimage?

    Thanks

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    If there's a database record for a file that doesn't exist on the server, you'll end up with weird stuff like the generic title you're getting.

    I'm guessing it's a write error on upload. See this thread:

    http://www.silverstripe.org/dataobjectmanager-module-forum/show/281632#post281632

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    Hmmm... well I've enabled debug for SFWupload which reports:

    SWF DEBUG: StartUpload: First file in queue
    SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
    SWF DEBUG: Global Post Item: parentIDName=ImageGalleryPageID
    SWF DEBUG: Global Post Item: OverrideUploadFolder=Uploads
    SWF DEBUG: Global Post Item: hasDataObject=1
    SWF DEBUG: Global Post Item: dataObjectClassName=ImageGalleryItem
    SWF DEBUG: Global Post Item: dataObjectFieldName=GalleryItems
    SWF DEBUG: Global Post Item: fileClassName=ImageGalleryImage
    SWF DEBUG: Global Post Item: controllerID=6
    SWF DEBUG: Global Post Item: AlbumID=10
    SWF DEBUG: Global Post Item: fileFieldName=Image
    SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://www.mywebsite.com/ImageGalleryManager_Controller/handleswfupload for File ID: SWFUpload_0_0
    SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
    SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 5877. Total: 5877
    SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Data: 34
    SWF DEBUG: Event: uploadComplete : Upload cycle complete.

    Now at this point I get a Windows pop-up dialog box that simply reports:

    Server said 34

    Which ties in with the Data ID in the debug message and the fact number changes every upload.

    So what is this message reporting? simply that record has been uploaded correctly?
    yet NO file is still written to filesystem

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    That's totally possible if you're getting a write error on upload. Did you read those threads? Here's the test for the upload write error..

    ----------

    ...you can test it by putting SWFUpload in debug mode, and editing /sapphire/filesystem/Upload.php:

    Line 85 (in 2.3.6)

    if(!$tmpFile['size']) {
    die(print_r($tmpFile));
    $this->errors[] = _t('File.NOFILESIZE', 'Filesize is zero bytes.');
    return false;
    }

    After an upload, you'll see the alert message come up with the output of the $tmpFile resource, including error #7, which is UPLOAD_ERR_CANT_WRITE.

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - upload fails to due to /tmp folder permsissions Link to this post

    I did read those threads, and as well as putting SFWUpload in debug mode (output above) I also edited Upload.php as suggested. Ok so the message box I'm getting is the result of the edit to Upload.php - sorry my mistake. So is a write failure implied in the message I'm getting or should the pop-up include some additional error code?

    So if this is a write error I just don't understand why. If I go into Files and Images section of SS I can manually upload images to my /assets folder (that is set to 777) but I can't manually upload to my image_gallery album folders (set to 755). Presumably when image_gallery creates the album folders it does so with group permissions that only allow that process access, so what seems to be happening is that while image_gallery is creating the folders it then no longer has permissions to upload files to it?

    3355 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.