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

SWFUpload implimentation


Reply


5 Posts   1964 Views

Avatar
micahsheets

Community Member, 165 Posts

24 June 2009 at 4:25am

I have a model admin interface that manages a DataObject that has Images associated with it. I want to be able to upload images with the swfupload but I also don't need any information stored with the images. No caption, title or anything other than the uploaded date. From looking at the ImageGalleryManager.php file I can see that it is more complex than a simple ImageField. I need to know what things are required to make this work. I see SWFUploadConfig::addPostParam() and SWFUploadField() and handleswfupload(). Are these all that is needed and if so is there any documentation on them anywhere?

Thanks.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

24 June 2009 at 7:20am

SWFUploadField isn't quite to the point yet that it can magically manage file relationships to a DataObject. You might want to reference this post:

http://www.silverstripe.org/dataobjectmanager-module-forum/show/261187#post261187

Describing how to build a simple resume upload form using SWFUploadField. To do what you're doing you will have to create your own handleswfupload() function in the controller. Totally possible, and quite easy (for me, anyway) to do. :-)

Avatar
micahsheets

Community Member, 165 Posts

24 June 2009 at 7:37am

I tried something similar, but I used SWFUploadFileIFrameField in my model admin. I see the iFrame but it has a login screen telling me that I don't have permission to access that page. The member I am testing with is not an ADMIN but I still need this to work.

Does SWFUploadFileIFrameField still only work with one file at a time?

Since I am using ModelAdmin and loading images for a specific DataObject, not a page, where do I put the handleswfupload()? Do I make a controller for my ModelAdmin or the DataObject?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

24 June 2009 at 7:56am

By default it will use the current controller. Not sure what that is in model admin. You can set a custom url in your config array.

'upload_url' => '/SomeController/handleswfupload'

Avatar
micahsheets

Community Member, 165 Posts

24 June 2009 at 11:18am

What is the exact syntax for 'upload_url' => '?

if I have a controller on a DataObject say "class Student_Controller extends Controller" then is the sytnax:

'upload_url' => '/Student_Controller/handleswfupload' ?

I noticed that in ImageGalleryManager you use Director::absoluteURL() when setting the upload_url, what does that do?

Also why is it that I can only use SWFUploadFileIFrameField in the CMS? That one only allows 1 upload at a time. Is there a way to allow using SWFUploadField in the CMS?