Go to content

bot_file_upload

When you need to associate files with an article you’ll probably do the same as me: create a custom field called ‘files’ and manually insert file ids in it. Then you call a file list in your artcle with something like:

<txp:file_download_list id='<txp:custom_field name="files" />' wraptag="ul" break="li"> <txp:file_download_name /> </txp:file_download_list>

(or use upm_file for txp versions pre 4.2.0).
This plugin doesen’t change this internally, it just operates at a visual level hiding the custom field and replacing it with an interface which lets you also upload and edit files from within the “write” tab – all without even touching the keyboard.

The plugin is heavily jquery based and basically uses an iframe to add and edit the files.
The principle is the same one of lam_image_uploader or this other attempt.

The plugin is configurable – especially from a visual perspective – by editing some variables direcly at the beginning of the plugin code.

  1. hello redbot,
    I’m using Txp 4.5.2 and a bunch of your plugins (file_upload, image_upload, wtc)
    in this plugin (file_upload) I found an issue with the name of the custom field.
    for some reason at line 264 this code:

    //$bot_cf_id = str_replace(”_set”, “”, array_search($bot_cf_name, $prefs)); // fetch cf internal name (custom_1 etc.)

    fails to get the name to insert in the javascript.
    it seems to work simply changing into (sorry, just quick and dirty):

    $bot_cf_id = $bot_cf_name ;

    thanks

    feragnoli | 9 December 2013 #

  2. Hi Redbot. As I said, I like a lot your plugins.
    Let me tell you I’m passing to last TXP (4.5.2) version, testing one by one the plugins that I most use. But I found an issue with this one. When I select some files for an article and then to press Publish button, the files that I chose, are no longer visible, but if then I select again “Add files” link, they are as checked.
    Does it happen just me or likely I found an issue in this version with your (fantastic) plugin ?
    Thanks in advanced

    Fernando | 30 November 2012 #

  3. Would there be a way to duplicate this plugin to do the same for links?

    Kamran Khan | 22 August 2011 #

  4. I figured out why I couldn’t get it working. I used bot_cf_titles to change the display name of the field, and it broke the functionality. Changing it within the plugin and custom field name fixed the problem.

    Mave | 10 July 2011 #

  5. Hi Randy, the plugin should work ok with txp 4.4.
    The first questions that come to mind seeing your error are: have you created a custom field named ‘files’? Or —if you want to use another name— have you configured the plugin accordingly?

    redbot | 28 April 2011 #

  6. Redbot: Thanks for the assistance. I now am actually wondering whether anyone has reported any issues with bot_file_upload and 4.04. When I have the plug in active — I get the following error message: Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘from textpattern where `ID` = ‘29’ limit 1’ at line 1 select from textpattern where `ID` = ‘29’ limit 1 in — when I turn it off the message goes away.

    Randy | 28 April 2011 #

  7. Hi Randy,
    actually the two plugins can interfere depending on the order in which they are loaded.
    Probably in your case bot_wtc is loaded first so bot_file_upload ovverrides the position you have set.
    Anyway that’s easily solvable in three ways:

    1) Change the plugins loading order in the plugins tab

    2) Set a preference in bot_file_upload. Look around line 28:
    ‘bot_filelist_position’ => ‘.title’,
    and change .title with the item you want

    3) Control the position only with bot_wtc. To do so you got to delete 2 lines in bot_file_upoad:
    the above mentioned line 28 and line 272 which reads:
    $(“label:contains($bot_cf_name)”).parent().insertAfter(”$bot_filelist_position”);

    redbot | 20 April 2011 #

  8. Great plug in (bot_file_upload). Quick question. When I use the plug in in conjunction with bot_write_tab_customize no matter what I try it throws the custom field files below the title field in the middle column. Like I mentioned, I have tried putting it in all diffreent plavces with no luck. Any suggestions would be appreciated.

    Randy | 20 April 2011 #

  9. Hi Gaerraty,
    as I’ll found the time I’ll release a new version which should indorporate some features from bot_image_upload (such as drag and drop support).
    However I’m sorry I don’t understand well what are you asking for. Maybe it has to do with this request?
    Or are you talking about collapse/expand capability?
    In this second case such ability is not introduced by me in bot_image_upload, it is the standard image field behaviour.
    If you want to add expand/collapse to any custom field you may found useful my other plugin bot_wtc wich will let you achieve this even with the current version. In case you may find this post useful

    redbot | 31 March 2011 #

  10. Awesome plugin!

    However is there easy way to get plugin look visually same as “bot_image_upload”? By this I mean that there would be similar “Files” section which could be expandable, thou separate from Custom Fields.

    Gaerraty | 31 March 2011 #