Moving Form Block File Uploads (change 'set')

Permalink
Hi,
I'm using the form block to allow user uploads. Rather than have the files go into the default, parent set, I'd like to add them to a different set such as 'public'.

I've been having a poke around in the form block controller, seeing if there's somewhere I could use 'addFileToSet'.

Can anyone give me any pointers?

I don't really need to go the whole single page route/external form for this. I just need to move the attachments.

Thanks.

moth
 
TheRealSean replied on at Permalink Reply
TheRealSean
Roughly around Line 252 in the controller for the form block.

I have copied mine over to the blocks folder.

Then I have added this
$type ="FileSet::TYPE_PUBLIC";
         $name ="Form Uploads";
         if (!FileSet::getByName($name)){
            $fs = FileSet::createAndGetSet($name, $type, $uID = false);
         }else{
            $fs = FileSet::getByName($name);
         }


Then into the else section of the
if (!($resp instanceof FileVersion)) {...}
else {
..
$fsf = $fs->addFileToSet($resp->getFileID());
}


I am currently toying with using different names,
so this is not fully working so more of an in progress
//Set name as Page name
$name = $c->getCollectionName();
//Use the Survey Name
$name = $this->surveyName;