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

Attn: UncleCheese / anyone - SWFUpload Problems


Go to End


9 Posts   5816 Views

Avatar
Rawbit

Community Member, 52 Posts

17 March 2009 at 6:13am

Hey,

First - great work on DataObjectManager and FileDataObjectManager. I was able to get the DataObjectManager no problems.

However, FileDataObjectManager is proving more tricky for me. I tried following the example in your youtube video (http://www.youtube.com/watch?v=E1msUj9CwRg&feature=related) but I got a SWFupload error. So with help from the forums I found a download here:
http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/swfupload/

After dev/build?flush=1, the swf error is gone and I see the same file upload lightbox-gui as in the video. However, when I click 'upload' on a pdf file i've chosen, I get a js alert box ''An error occurred in the upload. Try again later." - Any ideas?
I can post my debug info if needed.

Thanks

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 March 2009 at 7:18am

Edited: 17/03/2009 7:19am

First, make sure you have done an SVN checkout of the most recent version of dataobject_manager at this repo:

svn co http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/dataobject_manager

I've fixed a lot of bugs over the last week that were causing that error.

If you're at the latest version, add this to your _config.php:

SWFUploadConfig::debug();

And let me know what error is being thrown after the upload starts.

Avatar
Rawbit

Community Member, 52 Posts

17 March 2009 at 7:23am

Edited: 17/03/2009 8:04am

Thanks for the quick reply, here's my full output of the debug:

SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.pdf;*.doc;
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: controllerID=2
SWF DEBUG: Global Post Item: fileFieldName=PDF
SWF DEBUG: Global Post Item: dataObjectClassName=DownloadItem
SWF DEBUG: Global Post Item: dataObjectFieldName=DownloadItems
SWF DEBUG: Global Post Item: fileClassName=
SWF DEBUG: Global Post Item: controllerFieldName=Page
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://wamp/rob/silverstripes/project2/FileDataObjectManager_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: 273125. Total: 273125
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 500.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
Error Code: -200, File name: Google.pdf, File size: 273125, Message: 500

Avatar
Rawbit

Community Member, 52 Posts

17 March 2009 at 7:29am

Edited: 17/03/2009 8:04am

Thanks to UncleCheese, he was able to deduct I did not have a has_one for my DownloadItem

static $has_one = array (
'Page' => 'Page',
'Attachment' => 'File'
);

So the Attachment did it. Thanks UC!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 March 2009 at 8:12am

And thanks to rob, there is now a checkpoint in the constructor to ensure that a valid File relationship exists before going any further.

Avatar
Rawbit

Community Member, 52 Posts

17 March 2009 at 8:38am

UncleCheese,

I have a bit of a newbish question perhaps; how do I reveal the asset on the front end?

For example I have:
<% if DownloadItems %>
<% control DownloadItems %>
<li><a href="#">$Title</a></li>
<% end_control %>
<% end_if %>

Which works perfectly in displaying the Title of the items i've uploaded - however I don't know what the link would be. I have a bigger picture goal in mind of first requiring the user to provide their email address to even get these download links sent to them, but figuring out how to print the download links would be a great start :)

I didn't see it here: http://doc.silverstripe.com/doku.php?id=modules:dataobjectmanager but then again... that's me.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 March 2009 at 8:48am

Yeah, this is more fundamental SS stuff.

What you want is $Attachment.URL and $Attachment.Title.

There are others available, too $Attachement.FileType, $Attachement.Size..

Avatar
PeterB

Community Member, 18 Posts

7 August 2009 at 3:31am

Apologies for waking an old thread, I've been trying to find where the $Attachment variables are set (I want the raw file type, for example) and grepping the source code for FileType hasn't returned the location.

Can you help?

Thanks,
Peter

Go to Top