Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image Gallery - upload fails to due to /tmp folder permsissions

Go to End

16 Posts   3464 Views


22 May 2010 at 5:48am (Last edited: 8 September 2010 2:29pm), Community Member, 117 Posts

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.



22 May 2010 at 8:38am 4085 Posts

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


22 May 2010 at 9:52am (Last edited: 22 May 2010 9:54am), Community Member, 117 Posts

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?


25 May 2010 at 12:31pm Community Member, 117 Posts

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:


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?



25 May 2010 at 1:09pm 4085 Posts

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:


26 May 2010 at 12:53pm (Last edited: 26 May 2010 1:01pm), Community Member, 117 Posts

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 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 :(


26 May 2010 at 2:32pm 4085 Posts

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..

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

Line 85 (in 2.3.6)

if(!$tmpFile['size']) {
$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.


26 May 2010 at 11:21pm Community Member, 117 Posts

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?

Go to Top