1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

File Uploader filename?

Discussion in 'Professional Support' started by fabrik_83, Aug 3, 2018.

  1. fabrik_83

    fabrik_83 New Member

    Level: Community
    Hello,
    I'm uploading files for students and would like to have a field for either uploaded filename or added filename using an additional text field. This should be doable if I allow only one file upload at a time to correspond filename with each record/upload, but I don't know if this is possible when I'm using Ajax upload form for multiple file uploads. Is this possible through any Fabrik plugins? Thanks.
     
  2. fabrik_83

    fabrik_83 New Member

    Level: Community
    Hi, I thought I'd share my partial solution to this– just added simple jQuery script that grabs the file name from rendered Frabrik uploader display element's attribute, title, and added it to the link.

    jQuery('li .download-archive').each(function(){
    var $filename = jQuery(this).attr('title') ;
    jQuery(this).append($filename);
    });


    This works fine if I don't need to change the name of file uploaded, but I would like to see if there is a way to add custom file name at time of upload, or afterwards.
     
  3. fabrik_83

    fabrik_83 New Member

    Level: Community
    PS I'm looking to add linked file name field in addition to keeping original file name, not change file name with Rename code field, and for multiple file uploads. Thanks.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I'm not sure what you mean.

    Do you need to somehow "pre name" the upload? Or do you want to grab the uploaded filename and stick it in a field element?

    -- hugh
     
  5. fabrik_83

    fabrik_83 New Member

    Level: Community
    Hi Hugh,
    Yes, the later: put file name in field element that client can edit to make it more user friendly and semantic for students.
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK. One thing you could try is to put some code in the 'rename' option. Don't change it (so just return it unchanged), and as a side-effect set the field you want. The filename is in $filename, and you can use the usual $formModel methods, so something like ...

    Code (Text):

    $formModel->updateFormData('yourtable___name', $filename, true);
    return $filename;
     
    Replace yourtable___name with the full element name of the field you want to update.

    -- hugh
     
  7. fabrik_83

    fabrik_83 New Member

    Level: Community
    Thanks Hugh.
     

Share This Page