1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Export attachments easily

Discussion in 'Professional Support' started by georgie, Aug 9, 2015.

Thread Status:
Not open for further replies.
  1. georgie

    georgie Member

    Level: Community
    Hi

    I am a little annoyed...

    In a list, I have 3 fields fileupload (3 pdf, obfuscated and secure). Users autorized can download them in form view or detail, OK.
    I want ease the 3 exports (just in one export ; or by email ; or by a new button on form or list...).

    So I have tested an email form plugin, or a download list plugin, with many kinds of code, without succeed...
    I have tested with another fileupload, a simply jpg file, not secure, but same result.

    Indeed, email form plugin gives me a file, but empty or corrupted, and download list plugin do not load any download.

    :(

    Can you help me ?
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Trying to understand: you want (as one possibility) a button in list view where the user can download all 3 PDFs with one click in a zip-file?
     
  3. georgie

    georgie Member

    Level: Community
    Yes, for example, is will be a very good solution !
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    There isn't currently a plugin which would do exactly what you want. The list download plugin can zip up multiple files, but it is designed to do so for the same element in multiple rows, whereas you need multiple elements one (or more) row(s).

    Here's a screencast of the download list plugin working, downloading an image from two rows in a list:

    http://screencast.com/t/PrD3m21PqMH

    I'm going to have a quick look at enhancing that ...

    -- hugh
     
    georgie likes this.
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    georgie likes this.
  6. georgie

    georgie Member

    Level: Community
    Hi

    Thank you for the commit, I have done.

    But I think I have another problem, before this, because I can not load any upload, this for one or many element.

    Indeed, when I click on the button list, the page runs, but no download (no error neither).

    Please note that I have not the version library GD 2.1.1 ; I have the 2.1.0. Is it a problem ? How can I do this update ?
     
  7. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Not quite sure what you mean. Are you talking about the download list plugin?

    Nope, GD version wouldn't affect it, as all that's used for is scaling images if you select that option (so the plugin will reduce image size before zipping).

    Have a look in either Firebug or Chrome's devtools, look at the Network tab. You should see the download request fire off. Open that up and see if there are any errors or warnings in the response.

    -- hugh
     
  8. georgie

    georgie Member

    Level: Community
    OK. Yes, I am talking about dowload list plugin.

    Hum, I see no error in devtool's navigators, or I do not understand...

    I feel it is about some filters on my list...

    You can see my list here :
    http://www.driihm.fr/projets-deposes-ohms (after login, id:georgie pwd:georgie)
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    The credentials in your My Sites for backend access don't work any more. I need to see the config for the plugin.

    -- hugh
     
    georgie likes this.
  10. georgie

    georgie Member

    Level: Community
    Yes

    I had disabed, and now re-abled !
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, can you update from github again? Your download plugin seems to be erroring out, but due to a bug in our list plugin handling, the error msg is never getting shown.

    https://github.com/Fabrik/fabrik/commit/55ce969af53c0de9852a6d561300cdcb3f0236a3

    I suspect it's some kind of problem with the ZIP'ing process, and hopefully with the above fix to the error reporting, we should get some hint as to what the problem is.

    -- hugh
     
  12. georgie

    georgie Member

    Level: Community
    Hi, yes, thanks, I have now an error message, like "ZipArchive open error:", but without detail.

    It is an hint ?
     
  13. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Try this. Edit plugins/fabrik_list/download/download.php, around line 186 where it does the $zip->open, change OVERWITE to CREATE.

    According to some comments on the PHP site, the behaviour of that function is different in some versions of PHP.


    Sent from my HTC One using Tapatalk
     
  14. georgie

    georgie Member

    Level: Community
    Hi, I have done, but no change.

    Note that when I put a false element in list plugin option (like dxxxfgh___dfgxxx), I have another error message : "No files to ZIP!".

    Always "ZipArchive open error:" (with a true element), after changing for "CREATE".

    Like the plugin found the file, but was not able to load them...
     
  15. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    No, the "open error" is saying it can't create the temporary file it is zipping everything in to.

    I've added that filename to the error message ...

    https://github.com/Fabrik/fabrik/commit/473193ce3753a8a2888ad1e4c3075067932538a5

    Try updating, and see what file it is trying to create, and make sure that folder is writeable by your web server. I'm using PHP's sys_get_temp_dir() to get the main system tmp dir, so on UN*X it would typically be /tmp, on Windows it would be something like C:\Windows\Temp. And from reading the comments on php.net ...

    http://php.net/manual/en/function.sys-get-temp-dir.php#97044

    ... it's possible your server may be configured such that we can't write to that.

    So ... what you could try doing is using J!'s tmp folder instead. So around line 181, where we currently do ...

    PHP:

                $zipfile = tempnam(sys_get_temp_dir(), "zip");
     
    ... try this ...

    PHP:

                $config = JFactory::getConfig();
                $zipfile = tempnam($config->get('tmp_path'), "zip");
     
    Obviously make sure your ./tmp in the J! root is writeable by the web server.

    -- hugh
     
    georgie likes this.
  16. georgie

    georgie Member

    Level: Community
    Hey ! Indeed, it is better !!!

    After adding filename to the error message, from the commit, I had just a "::" more in my error message.

    But, after replacing $zipfile by :

    Code (Text):

              $config = JFactory::getConfig();
              $zipfile = tempnam($config->get('tmp_path'), "zip");
     
    Then, I can download one or many files in a zip ! Thanks !!! ;)

    Even if I do not understand exactly what does my Joomla temporary directory, a transfer folder? Files transit in tmp to become a zip, and then are deleted ?

    Well, big thanks !

    I have another question related to this function : I would, always to ease the export of a record and his fileuploads, allows the export of the zip in the form.
    Goal : a user can print the record, and in the same interface, export his attachments in a zip.

    Do you prefer I open a new topic ?

    Thanks again !
     
  17. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmm sounds like your PHP isn't even setting a system tmp folder. Oh well.

    The j! tmp folder is just that - a tmp folder for use by any J! code that needs to use it. And yes, this plugin creates the ZIP in your tmp folder, then deletes it when the download is finished, or if there are any (catchable) errors between creating and downloading it. You may find that some of the temp files don't get deleted - not just these ones, but others than J! and 3rd party extensions create - so you should occasionally check that folder and manually delete any junk piling up in it.

    With regards to downloading a ZIP from the form, there is currently no plugin to do that.

    -- hugh
     
    georgie likes this.
  18. georgie

    georgie Member

    Level: Community
    OK, thanks for details !

    Another way to do what I want (ease the export of a record and his attachments), will be to allow the export of the record (in PDF, like a print) in the list.
    Like the button to export attachments, I talk about another button.

    What do you think about ?
     
  19. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    So basically you want to be able to do the same as the PDF button on the detail view, straight from the list?

    -- hugh
     
  20. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    You could just change the default detail link so it does that ... in List settings, links, Custom Detail Link, just add format=pdf to the normal detail link ...

    Code (Text):
    /joomla30/index.php/main-test/details/1/{rowid}?format=pdf
    ... which works on one of my test lists ...

    http://screencast.com/t/LqZAROCipucQ

    -- hugh
     
Thread Status:
Not open for further replies.

Share This Page