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.
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:
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.
First, make sure you have done an SVN checkout of the most recent version of dataobject_manager at this repo:
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:
And let me know what error is being thrown after the upload starts.
Thanks for the quick reply, here's my full output of the debug:
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
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
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!
And thanks to rob, there is now a checkpoint in the constructor to ensure that a valid File relationship exists before going any further.
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 %>
<% 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.
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..
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?