Results 1 to 3 of 3

Thread: How to add a file type field

  1. #1
    larcman is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    12

    Default How to add a file type field

    Hi,

    Well, I'd like to learn how to add a type file field in a module.
    I read the developer guide and I know how to render that in the editViewvardefs.php (metadata), but the question is that I don't know how to upload the file and save it in cache/upload/

    Thanks
    Last edited by larcman; 2011-08-02 at 11:29 PM.

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: How to add a file type field

    The easiest way to have a field of ile type on sugar, is creating a module based on File template.
    As far I know if you want to add a file field in some other module type, you will need to program all the upload logic manually. In this case you have to do basically two things:
    1. Renderize a text field into a file field using custom code.
    2. Program some logic_hook to get the value input in this field and upload it to your server. You also can try do that by ajax.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    lukas242 is offline Junior Member
    Join Date
    Aug 2011
    Posts
    1

    Default Re: How to add a file type field

    Ok, i already upload file in cache/upload and save name file in "file_upload" clolumn in Tasks module
    how can I display a link to that file?

    I added this lines
    array (
    'name' => 'file_upload',
    'label' => 'LBL_FILE_UPLOAD',
    'type' => 'file',
    'displayParams' => array ('link' => 'file_upload','id' => 'file_upload')
    )

    in Detailviewdefs.php in custom/modules/Tasks/metadata/detailviewdefs.php
    but is doesn't seem to work.

    I forget something?

    maybe is possible to manual add "file_upload" to the bean to retrieve data from tasks?
    what files needs changes to do that?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to create a field of type "File"
    By mjp9119 in forum Developer Help
    Replies: 3
    Last Post: 2011-06-05, 10:38 PM
  2. Replies: 0
    Last Post: 2011-04-01, 08:48 AM
  3. file type(attachment field) in custom module
    By layman99 in forum Developer Help
    Replies: 0
    Last Post: 2011-03-29, 02:40 PM
  4. how to add a file type custom field from admin?
    By balukorrapati in forum Developer Help
    Replies: 0
    Last Post: 2009-10-08, 10:58 AM
  5. Add a "File" type field
    By argnom in forum Help
    Replies: 3
    Last Post: 2009-05-04, 07:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •