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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Using a FileIFrameField and ImageField in the same Dataobject's popup-window


Go to End


2 Posts   1750 Views

Avatar
pingu

Community Member, 75 Posts

31 August 2010 at 9:31pm

Edited: 31/08/2010 9:44pm

Hi guys,

I've got a media library where the content administrator can upload media files (images, PDFs, etc). For this, they need to be able to upload the file, name, description and a thumbnail image.

An issues arises when you first upload the file, if I try to add an image I get the following error:
Undefined index: uploaded_files
...
Line 393 in .../dataobject_manager/code/FileDataObjectManager.php

Is there a way to resolve this error without making modifications to FileDataObjectManager.php?

Avatar
adesweb

Community Member, 39 Posts

3 September 2010 at 4:06am

Replacing that line 393 in FileDataObjectManager with

if(isset($_POST['totalsize'])){
$total = $_POST['totalsize'];
}
elseif(isset($_REQUEST['uploaded_files'])){
$total = sizeof($_REQUEST['uploaded_files']);
}
else{
$total = 1; //Hardcode for iFrame
}

Seems to fix this issue, but you will get another error on uploading the thumbnail image. Closing and re-opening the file modal window and trying to upload again works, but not ideal. Anyone have a fix I am getting:

Fatal error: Call to a member function write() on a non-object in /home/adrianw/PROJECTS/bcl/website2009/sapphire/forms/FileIFrameField.php on line 209

Adrian