Skip to content

Dropbox like file picker javascript integration #2028

Open

Description

@shyamal890

It would be great to have nextcloud file picker integration for webapps.

Activity

  1. MariusBluem commented on Nov 6, 2016

    @MariusBluem
    Member

    This would require an open API for our file picker to integrate this into 3rdparty-applications ... I've seen some apps out there simply using WebDAV to access the files on Nextcloud 😉

  2. changed the title [-]Feature Request: Dropbox like file picker javascript integration[/-] [+]Dropbox like file picker javascript integration[/+] on Nov 7, 2016
  3. nickvergessen commented on Nov 7, 2016

    @nickvergessen
    Member

    Yeah WebDAV is our public API for that.

    Other than that I fail to understand what you are talking about. So a screenshot or more then one line of text would help.

  4. MorrisJobke commented on Feb 8, 2017

    @MorrisJobke
    Member

    @danielrodriguez That's what you talked about, right?

  5. loxK commented on Jun 1, 2017

    @loxK

    I think he is more likely referring to a file picker that third party app, or nextcloud app running in an iframe, could easily use to get a file, or file URL, from nextcloud in a nice dialog picker respecting the nextcloud look and feel.

    Example with google drive: https://gist.github.com/Daniel15/5994054

    Having to use a the webdav api and having to build an UI is overkilled. See how Rainloop are struggling to implement a simple nextcloud file picker whereas they have implemented with ease a Google Drive file picker.

    Need developers to add Nextcloud support to their apps ? Make it easy for them to do so.

  6. esanzgar commented on Jun 19, 2017

    @esanzgar

    @nickvergessen

    I think @shyamal890 may refer to something like this:
    https://developers.google.com/drive/v3/web/picker

    Am I correct @shyamal890 ?

  7. mehrdad-shokri commented on Oct 23, 2017

    @mehrdad-shokri

    any updates on this?
    @shyamal890 did you solve this need?

  8. skjnldsv commented on Jun 12, 2019

    @skjnldsv
  9. 17 remaining items

  10. pbek commented on Aug 6, 2020

    @pbek
    Member

    I put our Nextcloud WebDAV file picker in the example of https://apps.nextcloud.com/apps/webapppassword.

    WebDAV File Picker

    screenshot-filepicker

    Temporary password generation and WebDAV PROPFIND

    screenshot-webdav

    There is an example implementation
    that uses this app to generate a temporary password and make a WebDAV request to a Nextcloud instance (docker container included).

    See Example for a Nextcloud WebDAV file picker example that uses this application.

  11. julien-nc commented on Oct 12, 2020

    @julien-nc
    Member

    @pbek Wow this is great! I would like to play with the filepicker and potentially bundle it in a Vue component. Could you give me access to https://gitlab.tugraz.at/dbp/web-components (which appears to be private) so I can get the filepicker sources?

  12. pbek commented on Oct 12, 2020

    @pbek
    Member

    @eneiluj, sure, I'll discuss if we can already open the repository to the public. Meanwhile you can play with the built version of it from https://gitlab.tugraz.at/dbp/nextcloud/webapppassword/-/tree/master/docs/example if you like.

  13. julien-nc commented on Oct 12, 2020

    @julien-nc
    Member

    @pbek Yeah I used it (it's awesome 😁) and then failed to use the files provided there in a Vue component. That's why I'd like to try with the file picker sources.

    Thanks for your answer.

  14. pbek commented on Oct 12, 2020

    @pbek
    Member

    Thank you, @eneiluj 😁 Out of curiosity, do you already have a use case where you want to put the vue.js filepicker? 😀

  15. pbek commented on Oct 13, 2020

    @pbek
    Member

    I'll discuss if we can already open the repository to the public.

    @eneiluj, meanwhile I extracted you what's needed to build the file-picker here: https://gitlab.tugraz.at/dbp/nextcloud/webapppassword/-/tree/master/docs/example/src

  16. julien-nc commented on Oct 26, 2020

    @julien-nc
    Member

    @pbek Sorry for the late answer. Thanks a lot for the sources.

    This file picker could be used in any website/web application. I don't have a precise use case for the moment. It would be great to "bundle" it a little bit and make it available as a standalone component for anyone who wants to integrate a Nextcloud file storage in their system.

    I made a small change to allow passing login and password (as optional attributes) to the top element dbp-file-source and avoid seeing the authentication popup. I can provide the patch if you're interested.

    I'm stuck trying to understand how to use dbp-file-source or dbp-file-sink to upload files to Nextcloud. It seems dbp-file-sink should react to the files property update but I didn't find how to do that from the "outside". Is there an example somewhere?

  17. pbek commented on Oct 26, 2020

    @pbek
    Member

    It would be great to "bundle" it a little bit and make it available as a standalone component for anyone who wants to integrate a Nextcloud file storage in their system.

    We are planning to create bundles for all web components in the future that can directly be included to a webpage. 😀

    I made a small change to allow passing login and password (as optional attributes) to the top element dbp-file-source and avoid seeing the authentication popup. I can provide the patch if you're interested.

    We wanted to avoid entering (and storing) usernames and passwords. 😉

    I'm stuck trying to understand how to use dbp-file-source or dbp-file-sink to upload files to Nextcloud. It seems dbp-file-sink should react to the files property update but I didn't find how to do that from the "outside". Is there an example somewhere?

    The repo with a good example is also still closed. I'll put that on the list for discussion too...
    But basically it's like stated in https://gitlab.tugraz.at/dbp/nextcloud/webapppassword/-/blob/master/docs/example/src/packages/file-handling/README.md, there is a files property which you can set directly from outside the file-sink web-component. See: https://www.w3schools.com/js/js_object_properties.asp

    document.querySelector('#file-sink').files = files;

    File as in https://developer.mozilla.org/en-US/docs/Web/API/File

  18. julien-nc commented on Oct 26, 2020

    @julien-nc
    Member

    We are planning to create bundles for all web components in the future that can directly be included to a webpage.

    That would be nice.

    We wanted to avoid entering (and storing) usernames and passwords

    I was not explicit enough. The goal is not to prompt the user or to store anything. It is rather to allow the developer to inject credentials coming from somewhere else.

    document.querySelector('#file-sink').files = files;

    Perfect, thanks. Will try that.

  19. pbek commented on Nov 19, 2020

    @pbek
    Member

    You can now also install the file-handling components via npm!

    npm i @dbp-toolkit/file-handling

    After you have installed the file handling components via npm you can use this example to get a button
    that opens the file source dialog. After you have selected a file you will see it in your browser log,
    and the file sink dialog will open, so you are able to store the file again.

    <button onclick="openFilePicker()">Open file picker</button>
    <dbp-file-source lang="en"></dbp-file-source>
    <dbp-file-sink lang="en"></dbp-file-sink>
    
    <script>
        const fileSource = document.querySelector("dbp-file-source");
        const fileSink = document.querySelector("dbp-file-sink");
    
        // Listen to the event from file source
        fileSource.addEventListener("dbp-file-source-file-selected", (ev) => {
            const file = ev.detail.file;
            console.log("File selected: ", file)
    
            // This will open the file sink dialog
            fileSink.files = [file];
        }); 
    
        function openFilePicker() {
            // This will open the file source dialog
            fileSource.setAttribute("dialog-open", "");
        }
    </script>
    <script type="module" src="node_modules/@dbp-toolkit/file-handling/dist/dbp-file-source.js"></script>
    <script type="module" src="node_modules/@dbp-toolkit/file-handling/dist/dbp-file-sink.js"></script>
  20. binford6000 commented on Dec 1, 2023

    @binford6000
    Contributor

    @julien-nc Any updates on this topic?
    I've been asked from a prospect if we gonna have this in the future...

  21. pbek commented on Dec 1, 2023

    @pbek
    Member
  22. binford6000 commented on Dec 1, 2023

    @binford6000
    Contributor

    Thx for the update @pbek ! Looks interesting. Will have a look into it 👍🏻

  23. pbek commented on Dec 1, 2023

    @pbek
    Member

    I just updated webapppassword for Nextcloud 28. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions