Jump to:

11004 Posts in 2735 Topics by 1824 members

All other Modules

SilverStripe Forums » All other Modules » Attn: UncleCheese / anyone - SWFUpload Problems

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 4223 Views
  • Rawbit
    Avatar
    Community Member
    52 Posts

    Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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.

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

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

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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..

  • PeterB
    Avatar
    Community Member
    18 Posts

    Re: Attn: UncleCheese / anyone - SWFUpload Problems Link to this post

    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

    4223 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.