Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Multiple file attachment for a user View modes: 
User avatar
Member
Member
mail2rozario-gmail - 12/13/2010 7:58:05 AM
   
Multiple file attachment for a user
Hi,

I am building an community portal where the user needs to attach his files(PDF, Doc) while he registers and able to modify the same in the User Edit form. Also we have used User Display Form to display the user where we also need to display the user attachments so as we can download or view the attachment by clicking on it. Can you please suggest me an solution how to achieve this. (I can see an File attribute in system table but not able to see Document attachment)

Thanks
Rozario

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/3/2011 5:26:59 AM
   
RE:Multiple file attachment for a user
Hi,

Unfortunately, document attachment field type is not supported in the system table because of security and performance reasons.

Alternatively, you could use file selector to enable user upload their files. You can add the field of file selector type into cms.user system table and then into the layout of appropriate alternative forms.

To display link to file in the Display Profile alterantive form please do not forget to set Default Visibility in field definition (in aleternative form) and then change the field type to label - this way GUID will be displayed instead of file selector.

Instead of Field type: Label control you can create a custom form control that will create a link from the GUID. How to create path to file based on its guid is shown in the below code:

                     
Guid iguid = new Guid("eb1b5175-d7e6-479e-a19e-dbd6be035c16");

// Tree node
CMS.TreeEngine.TreeNode node = null;

// Tree provider
UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);
// Get Single node specified by it`s GUID, culture code, site code
node = tree.SelectSingleNode(iguid, CMSContext.CurrentPageInfo.DocumentCulture, CMSContext.CurrentSite...SiteName);


string href= node.NodeAliasPath + ".aspx";


Another approach is to use user contribution in combination with custom document type to enable users upload files.

Please take a look at following example:
devnet.kentico.com/docs/devguide/example_editing_partner_profile.htm

Using above approach user could attach files for example on his profile page. Each user could edit only his profile page, but could see (download) files from profile of other users.

Best regards,
Ivana Tomanickova