GithubHelp home page GithubHelp logo

Local Filesystem about orioncms HOT 31 CLOSED

orionjs avatar orionjs commented on July 30, 2024
Local Filesystem

from orioncms.

Comments (31)

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

I have not create a adapter for local filesystem, but it's very easy to create an adapter.

  • Create the upload function:
orion.filesystem.providerUpload = function(options, success, failure) {
    /**
     * Here you will recive the file in the variable options.fileList.
     *
     * You have to upload the file using the method you want.
     *
     * If the file was uploaded successfully call success(fileUrl, optionalData)
     * The optionalData will be saved in the meta variable
     *
     * If not call failure(error).
     */
}
  • Create the remove function:
orion.filesystem.providerRemove = function(file, success, failure)  {
   /**
     * Here you will recive the file object, containing the url and 
     * the optionalData in file.meta.
     *
     * You have remove the file.
     *
     * If the file was removed successfully call success()
     *
     * If not call failure(error).
     */
}

You can see an example here https://github.com/orionjs/s3/blob/master/lib/main.js

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

If you create an adapter please upload it to atmosphere so everyone can use it!

from orioncms.

matteodem avatar matteodem commented on July 30, 2024

I'll see if I have time the next days, thank you for the answer.

from orioncms.

matteodem avatar matteodem commented on July 30, 2024

Is this implemented now 😉?

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

No, its not. Just answered the question

from orioncms.

matteodem avatar matteodem commented on July 30, 2024

Then there's a missing ticket for the actual feature, right?

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

Nope, just answered your question. You said you're going to do it

from orioncms.

matteodem avatar matteodem commented on July 30, 2024

"I'll see if I have time the next days, thank you for the answer." not seeing anything that states that I would do it. But it's your decision after all.

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

Ok, lets leave this open better

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Any news concerning this file upload on the local filesystem?
Any example on how to bind this with https://github.com/aldeed/meteor-cfs-autoform maybe?

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

@rdewolff using another provider has nothing to do with autoform. Just fill the functions! It's super-easy, give it a shot. I haven't read cfs docs, but the solution might be similar to this:

orion.filesystem.providerUpload = function(options, success, failure) {
     CFS.uploadFile(options.fileList, function(error, response) {
          if (error) {
               failure(error)
          } else {
               success(response.url, { localPath: response.localPath })
          }
     })
}

orion.filesystem.providerRemove = function(file, success, failure)  {
     CFS.removeFile(file.meta.localPath, function(error, response) {
          if (error) {
               failure(error);
          } else {
               success();
          }
     })
}

If you put that code in your app (of course that will not work because it's not the real cfs api) all file inputs will use that functions to upload files

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Am trying to use FS.Collection to do this but it's not working. I got problems to handle the file upload and calling the success function.

Could your provide a more detailed example please?

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

cf. https://github.com/CollectionFS/Meteor-CollectionFS

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Seems that the "success" function called at the end of the file upload is not accepting URL with Port number!

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Here is the code am using : https://gist.github.com/rdewolff/5777563b491ac27544ec

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

Can you make a pull request on filesystem to accept files with port? It currently uses SimpleSchema.RegEx.Url to check.
https://github.com/orionjs/filesystem/blob/master/lib/collection/init.js

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Actually it's not the port number causing problem, but a host name without ".com" or "dot something".

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

Any updates on this implementation. I am willing to work with someone if they would like to collaborate to come up with a solution.

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

@rwatts3 I think @rdewolff solution might work with the new update of filesystem https://github.com/orionjs/filesystem/commit/de9ad944f7ba2fa4163b2a97e79213c7db3e1db8 (Don't check urls)

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

ok so I should just update filesystem and remove orionjs:s3 and it should work ?

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

If the only thing that was preventing @rdewolff solution to work was the checking of the urls, it should work.

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

Hmm , ok I will give this a shot. @rdewolff When ever you have the solution solved are you planning on creating an extension package ? such as orionjs:filesystem-local

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

Thanks @nicolaslopezj for updating the url type to String. The error concerning localhost has been already reported earlier, cf Meteor-Community-Packages/meteor-simple-schema#239.

Concerning the file upload on file system, I think a simple package would be great. Let's do that!

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

@rdewolff I will be willing to work with you to create a package if that is okay with you. Let me know what ideas you have.

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

@rdewolff Could you post a gist on the code you are using to get this working. I tried to view the gist posted earlier but for some reason it's not available anymore.

Thanks

from orioncms.

rwatts3 avatar rwatts3 commented on July 30, 2024

@nicolaslopezj are you planning on doing the official extension for this ? if you are i'd like to work with you and assist. I would do it myself but would like to make sure it'd done the correct way with your insight on future extension of orionjs

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

I'm not going to make a official extension. But if anyone make one, I would help.

from orioncms.

rdewolff avatar rdewolff commented on July 30, 2024

hey @rwatts3 - here is the gist for the file upload. Notice is just a basic implementation to support single file upload and there is no delete method implemented yet.

https://gist.github.com/rdewolff/84ed3f3be3f24f58c1db

from orioncms.

loongmxbt avatar loongmxbt commented on July 30, 2024

Will Orionjs v1.0 include the local filesystem feature? The current implementation has no delete method and every time I upload an image, the page will automatically refresh and then display the right image.

from orioncms.

loongmxbt avatar loongmxbt commented on July 30, 2024

Just now I made a package that includes delete method. But the code is not so good-looking. After all it works. Hope it's helpful for the release of official local filesystem package.

https://gist.github.com/loongmxbt/da2b361785ca6f9ad574

PS: Still have some bugs. In remove cannot find the fileObj.

Fix the bug, now can delete file on local server. Files.remove(cfs_id) not an FS.file obj.

https://github.com/loongmxbt/orion-lfs

from orioncms.

nicolaslopezj avatar nicolaslopezj commented on July 30, 2024

https://github.com/lc3t35/orion-filesystem-local

from orioncms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.