Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Image Gallery Custom Form

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1365 Views
  • Lydia
    Avatar
    Community Member
    6 Posts

    Image Gallery Custom Form Link to this post

    Hi,

    Im working on a site where people can register their own clean-up event and it gets listed on the site - another feature is uploading images to the image gallery - I have the image gallery installed and its working fine on the CMS side - there are three different albums at the moment - what I'm looking to create now is a Custom Image upload form on the FrontEnd where those who have participated in a clean-up event or hosted a clean-up event can upload their photos to one of the galleries - I could just create a simple image field upload however I'd like to use swfUpload feature - currently Ive just tried editing the example given for sending a document with in an email however I know this won't work as the submit function needs editing - Ive got the form displaying fine and swfUpload will attach file just the submit section needs work!! Clearly I'm far from being a master coder - Could someone point me in the right direction?? It would be greatly appreciated!!

    THIS IS WHAT I'm working with:

    public function CleanUpImageForm(){
       
       SWFUploadConfig::addFileTypes(array(
          'jpg','tiff'
       ));
          
       return new Form(
          $this,
          "CleanUpImageForm",
          new FieldSet(
             new TextField('Name'),
             new SWFUploadField(
                "CleanUpImageForm",
                "CleanUpPic",
                "Upload your images",
                array (
                   'file_upload_limit' => '2',
                   'required' => 'true'
                )
             )
          ),
          new FieldSet(
             new FormAction('doImageSubmit','Apply now')
          )   
       );
    }

    public function handleswfupload(){

    if(isset($_FILES['swfupload_file']) && is_array($_FILES['swfupload_file']))
    echo Folder::findOrMake('CleanUpPics')->addUploadToFolder($_FILES['swfupload_file']);
    else echo ' ';
    }

    public function doImageSubmit($data,$form)
    {
          $upload = new File();   
          
          if(isset($_POST['uploaded_files']) && is_array($_POST['uploaded_files'])) {
             
             foreach($_POST['uploaded_files'] as $id) {
                $file = DataObject::get_by_id("File",$id);
             }
             $upload->write();
             Director::redirect('gallery/');

          }

  • Lydia
    Avatar
    Community Member
    6 Posts

    Re: Image Gallery Custom Form Link to this post

    THIS IS THE ALERT ERROR I GET WHEN I SEND THE IMAGES WITH THE FOLLOWING CODE:

    CAN ANYONE HELP ME DEBUG THIS???

    [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://cleanupweek.toast.co.nz/swfupload/javascript/fileprogress.js?m=1245792615 :: FileProgress :: line 42" data: no]

    1365 Views
Page: 1
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.