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.

All other Modules /

Discuss all other Modules here.

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

SWFUpload Documentation


Go to End


9 Posts   7624 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

16 January 2009 at 4:20pm

I've posted the documentation for SWFUploadField here: http://doc.silverstripe.com/doku.php?id=swfuploadfield

Avatar
schellmax

Community Member, 126 Posts

20 April 2009 at 10:46pm

i was just wondering wheter it's possible to use SWFUploadFileIFrameField in a popup in the cms.
this to avoid the common 'You can add images once you have saved for the first time.' hassle of Imagefield.
unfortunately, it doesn't seem to work (using swfuploadfileiframefield in getCMSFields_forPopup gives errors).
is this supposed to work so i am doing something wrong?
or maybe there's a more clever way to circumvent the 'upload after first save' issue?
thanks in advance

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 April 2009 at 3:39am

Hello,

Thanks for your interest in the SWFUpload module. The SWFUploadFileIFrame field is useful for filtering out unwanted file types and sizes and displaying a progress bar for large files, but one thing it cannot do is overcome the (annoying) issue of having to save a new record before adding a file. The reason is because your file object needs an "ownerID" to make the correct association with your DataObject class. Until the record is saved, that ID of course, does not exist.

If you're looking for a better way of handling this issue, I'd recommend using the DataObjectManager. Though it doesn't have a "fix" for the problem, it is handled in a much cleaner way with clear language to the user. For instance, if your DataObject has a File relation called "Image", the save button on a new record will read "Save and add Image" -- as opposed to a standard CTF, which will advance the user to a new record without any indication that a file has not been added.

Try it out!

Avatar
Judge

Community Member, 79 Posts

7 March 2010 at 12:15pm

I know this is an old post, but is the "owner ID" statement still relevant? I thought it was the owner that points at the File or Image record rather than the File or Image that points at the owner. A file can be uploaded onto the system without linking it to any other objects.

It ought to be possible to upload the files first, and getting their unique IDs. Once the main record is saved, it can be linked to the files. The files could even be uploaded to a special object that labels them as temporary, and they can be cleaned up by some house-keeping if they are not linked to some object within a given time-frame.

-- Jason

Avatar
Judge

Community Member, 79 Posts

7 March 2010 at 12:21pm

I guess the documentation has been moved, but all links seem to point back to this same dead page.

-- Jason

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 March 2010 at 5:11pm

This is the correct link:

http://doc.silverstripe.org/doku.php?id=modules:swfuploadfield

What you're describing is the way SWFUploadField works. SWFUploadFileIFrameField has been deprecated.

Avatar
sparkalow

Community Member, 8 Posts

9 March 2010 at 6:35am

Not sure where to submit bugs/fixes, so UncleCheese direct me if needed.

Portability issue with SWFUploadFileIframeField:

The RelativeLink method returns a url that is not entirely portable and was causing uploads to fail with a 404 on a site we have installed in a subfolder.

The fix was to replace

public function RelativeLink($action = null)
{
if($action === null) $action = "index";
return "/swfuploadfile/$action/".$this->urlParams['Class']."/".$this->urlParams['ID']."/".$this->urlParams['Field'];
}

with

public function RelativeLink($action = null)
{
if($action === null) $action = "index";
return "swfuploadfile/$action/".$this->urlParams['Class']."/".$this->urlParams['ID']."/".$this->urlParams['Field'];
}

removed the "/" from the beginning of the return.

Avatar
ryeze

Community Member, 6 Posts

12 July 2011 at 8:26pm

I am very interested in this SWFUpload module. I'm building a website, I have some problems with file uploads. could you please give me a code for the example application using this module. existing code in http://doc.silverstripe.org/old/modules:swfuploadfield not help me. thanks.

Go to Top