Feature request: file uploads added to set

Permalink Browser Info Environment
The option to automatically add files uploaded to a particular set would be helpful.

Type: Discussion
Status: New
facerX
View Replies:
TNTdesign replied on at Permalink Reply
TNTdesign
I figured out, from another post, how to get this working. In the 'upload_file.php' file, underneath:

$resp = $fi->import($_FILES['Filedata']['tmp_name'], $_FILES['Filedata']['name']);



I added:

$fs = FileSet::getByName('Uploads');
$fsf = $fs->addFileToSet($resp->getFileID());



Uploads is the name of my file set. The only thing I'm not sure how to do is specify different sets for different forms. Currently, all of my uploaded files would go into the Uploads file set, so if I have another form with an upload button, they would also be placed in the Uploads set. It would be nice if there was a way to specify sets from within the advanced form application.
waynemoore replied on at Permalink Reply
waynemoore
This works well, but I need to add to a file set dynamically based on the user name of the current session. I already have a file set with the same name as the user and this works great if I declare the file set name outright like in the above example. I am using very similar code to create the file set based on the user name and it works great, but when I add the code below to upload_file.php the files get uploaded to the file manager but are not placed in the set.

$u = new User(); 
$username = $u->getUserName();
$fs = FileSet::getByName($username);
$fsf = $fs->addFileToSet($resp->getFileID());

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.