ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

File upload field for Member Profiles

September 30, 2009 4:57pm

Subscribe [6]
  • #1 / Sep 30, 2009 4:57pm

    Scott Hepler

    11 posts

    I’m thinking about ways of creating a custom file upload field in Member Profiles (to store a CV in this case).

    I had hoped for something elegant like exists for weblogs, but can’t find any extensions which appear to enable this.  I’m also not all that keen on re-purposing avatar or signature fields since we might be wanting those later. My current system of a separate weblog for these data feels a little cobbled-together, so I’m hoping somebody here will suggest a head-slap easy way that I’ve managed to ignore.

    Thanks!

  • #2 / Oct 05, 2009 11:31am

    Nine Four

    1 posts

    Hi Scott, interested to hear how you solved this issue, we have a similar requirement here on a current project. 😊

  • #3 / Oct 05, 2009 11:39am

    Scott Hepler

    11 posts

    Well, we haven’t really.  It seems like we’re just going to store the URL in a custom field then use a Flash file manager to deal with that field in a user-friendly way.  Let me know if you find something more-cool!

  • #4 / Oct 05, 2009 11:42am

    nathanpitman

    531 posts

    Sorry, posted with wrong user account! Yes I think we might end up coding an extension or something to handle this. I’ll post back here with our results! 😊

  • #5 / Nov 06, 2009 4:02pm

    Brad Parscale

    196 posts

    Just curious of what you all did with this? Would you like to share?

    Brad

  • #6 / Nov 06, 2009 4:24pm

    nathanpitman

    531 posts

    We’ve ended up using the solspace user module and have the written an extension which hooks into this to allow for any file to attached to a member profile, storing the file URL in a custom member profile field. 😊

  • #7 / Nov 06, 2009 4:26pm

    Brad Parscale

    196 posts

    Yep,

    I am going the same direction. Was hoping just to grab something for the file upload but doesn’t look like that will be happening. Thanks!

    Brad

  • #8 / Nov 07, 2009 3:39am

    nathanpitman

    531 posts

    Well if you’re using the Solspace user module here’s an extension to that which you can use to add a file upload feature (attached).

    Example template code:

    {exp:user:edit form_name="edit-profile" form_id="edit-profile" member_id="{logged_in_member_id}" password_required="n" required="location" return="/member/profile/edit/updated"}
    Upload DOC or PDF
    
    <input type="file" name="attachment_filename" />{if attachment_filename} or <input type="submit" class="btn_del" name="remove_attachment" value="Delete?" />{/if}
    <input type="submit" class="btn" value="Submit" />
    {/exp:user:edit}

    Obviously you’ll need to create a custom member profile field called ‘attachment_filename’ and then specify the following in the extension settings:

    * File upload folder (no trailing slash, full server path) 
    * The short name of the custom profile field to upload from
    * The maximum file size of uploads in MB

    That’s it, hope someone finds this useful! 😊

  • #9 / Nov 07, 2009 1:31pm

    Brad Parscale

    196 posts

    Thanks a ton! Worked perfectly. One question though. Did you write it to intentionally use the random name it gives the file name or can you set it to keep the original file name?

    Regards,

    Brad

  • #10 / Nov 07, 2009 2:00pm

    nathanpitman

    531 posts

    We set it to generate a md5 hash of the filename on purpose but this could easily be changes by editing line 125 to:

    $file_name = $parts[0].'.'.$parts[1];

    😊

  • #11 / Nov 10, 2009 4:40pm

    Brad Parscale

    196 posts

    Thanks again. This works great. Just to note to others. You have to make some changes if you want to use this extension on a site where you have more then one template to user:edit because the code runs on all user forms and will give you a custom field error.

  • #12 / Nov 10, 2009 4:51pm

    nathanpitman

    531 posts

    Well spotted! I guess we could add an option to the extension to specify a form id or similar upon which the extension should come into play.

  • #13 / Nov 10, 2009 4:53pm

    Brad Parscale

    196 posts

    This really is a super handy extension. A nice upload=“y” in the user edit tag would be great. This is great for bio resumes, vitas, etc…

    Brad

  • #14 / Nov 10, 2009 4:56pm

    nathanpitman

    531 posts

    I’m not sure if we could pick that parameter up from the extension but I’ll check with our developer. We’re also using it to allows a user to attach a CV to their profile. Incidentally I don’t think the file size and type check is working correctly at present (just so you are aware).

  • #15 / Feb 06, 2010 9:53pm

    I’m not sure if we could pick that parameter up from the extension but I’ll check with our developer. We’re also using it to allows a user to attach a CV to their profile. Incidentally I don’t think the file size and type check is working correctly at present (just so you are aware).

    Hi Nathan,

    Is there an easy way to allow uploading other file types? Eg: TIFF, JPG etc

    Regards
    Martin

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases