6

I wrote a component and need a field there where the user can pick a pdf from the media manager. When I set the field-type in the field list to «media», the media-manager only shows images.

How do I make it show all files instead of images only?

5 Answers 5

3

I have not tested this in later Joomla versions, but at least in 2.5.x it was possible to display a list of files in a folder in the form of the drop-down.

The path is hardcoded and rather limited , BUT for some use cases it may just do the trick and provide the flexibility needed.

Ladies and gentleman, presenting the filelist:

    <field 
        name="yourfile" 
        type="filelist"
        label="COM_EXAMPLE_FIELD_YOURFILE_LABEL" 
        description="COM_EXAMPLE_FIELD_YOURFILE_DESC" 
        directory="media/com_example/files/"
        hide_none="true"
        hide_default="true"
    />
3

In case anyone is still interested, I've described a solution here, where a plug-in is used to override the imageslist view of com_media so that it shows all files in the media manager. I've put the code on GitHub.

I'd be first to admit that this is a less than elegant solution, but it works for the project I developed it for. I would treat this code as a starting point for your project, not a polished solution.

2
  • 2
    Welcome to StackExchange. It's generally better to include the solution (or part of it) in the answer. If the link breaks the answer is useless.
    – johanpw
    Commented Apr 1, 2015 at 11:44
  • I used your plugin in Joomla 3 as well. Because this issue is still not resolved. Commented Nov 7, 2015 at 17:44
2

Extending on the suggestion by @ValentinDespa, you can use the filelist form field type, and add a filter parameter. Any regular expression can be added here, see example below for how to filter PDF-files only.

<field type="filelist" name="pdf" label="Select PDF" directory="images" filter="\.pdf$"/>

enter image description here

This works fine in Joomla 3.x, BTW.

1
  • Upvote for the regex. Commented Jul 27, 2016 at 8:35
1

The Media form field type is used to select an image. So it filters out other files. Have a look at Joomla documentation for the available standard form fields types. You might also want to consider to create your own custom modal form field type for your component.

2
  • 1
    That's a joke, right? The media manager lets me upload PDFs, video and whatnot, but it won't let me actually SELECT them? I'm forced to write my own form-field? Isn't there a way to tell the Media-field to NOT exclude other files? (I know you're not responsible for this behavior, so don't take this rant-like reply personally :)
    – Swissdude
    Commented May 21, 2014 at 20:59
  • Unfortunately, as far as I remember, the filter is actually hardcoded. Commented Jun 23, 2014 at 15:14
0

You can use JCE editor with plugin file manager.

https://www.joomlacontenteditor.net/downloads/plugins/file-manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.