-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans to include an upload component with example? #68
Comments
Great, let's do it.
What I actually planned is to add new "input" control type "upload" into forms which automatically adds required packages into app (without explicitly specifying them). If you want to play with that, you can find form template in
please leave uppercase strings as is - they are automatically replaced by generator Code that reads from data on submit is located in Packages that will be automatically included by generator are listed in:
Usage of this would be like other input types:
And I will add required functionality into generator core if needed by your instructions. What do you think? |
As soon as I've solved that, I'll try to make that input control following your instructions, and send you a PR (my first one, actually). |
I have used this package to great success. Maybe you can consider using that |
I would like to use slingshot with a local GridFS at first in order to be able to switch to S3 later with the direct upload benefits. From my (little) understanding, I just need to wrap the server side gridFS code into the Slingshot directive. Is that correct? I'm gonna try anyway :) |
I gave up with slingshot since it doesn't look like it's easily adaptable to GridFS. I discovered a package that makes everything I expect from a file upload feature. I has no built-in file ownership constrains so it could be integrated with meteor-kitchen user-account system. A few details from the package readme:
The file-collection is built on to of Meteor.Collection but it does not support the same options, so when I load it, I get an error 8 from meteor:
Where should I declare the file collection if I want to load it correctly? |
@perak @xumx I'm making progress. I adapted this meteor-file-collection package (mentioned above) to the meteor-kitchen setup. Before I go further, I wanted to ask your opinion on the best way to do things. Here is what I have in mind:
The pros:
Several cons:
|
@Billybobbonnet nice to see you are making progress! 👍 Can you please deploy (to meteor) simple example, I wish to see how that works. But, need to say, I am not happy about 404 errors, using cookies... but in worst case, we can use your solution as transitional solution - currently we don't have any upload possibility, so everything goes. P.S. I'l upload latest version of meteor-kitchen later today (v.0.9.33) your loadinTemplate is included ;) |
Important! @Billybobbonnet Be careful - if you install latest version, your ~/meteor-kitchen directory will be overwritten - wach out and don't loose your work on upload!!! |
@Billybobbonnet please let me know if you need, in order upload field type to work, to add new properties to "field" object (and if some strings from template should be replaced by kitchen while generating code, similar to already existing FIELD_NAME, FIELD_TITLE, etc.). |
@perak I made you an example here: https://github.com/Billybobbonnet/meteor-kitchen-upload-example See the differences with the minimal example with account system between the two previous commits. I only added a file collection before building the example. In this version, you can upload an image with preview, drag & drop, to the server on the user_details page. Several things to be noted:
|
I did not pay attention to this message. I guess it is up to what you decide. The minimal set would be just the FIELD_FILE string containing the file URL. We could add some options:
|
Great! I am busy with my job at the moment but will take a look later (can't wait!) :) P.S. you got tails from git merge conflicts |
lol yes, I still need to learn to properly use git. |
:) no worries, take your time - I'l take a look later today (in few hours). |
Any chance to see live example? P.S. did you resolved merge conflicts? If so, please push your code. TNX |
the merge conflicts are solved in a fresh repo: https://github.com/Billybobbonnet/meteor-kitchen-upload-example live example: kitchenupload.meteor.com. |
Looks good, thanks! I'l clean-up the code little bit and add it into official distribution, but not before next weekend. Keep me updated if you make more progress on this. 👍 |
I have added an upload percentage display and a set of filters for files in client/lib/files_utils.js. What I plan/want to add is (including items above) :
Concerning the 404 errors, making it 204 could not be a solution (see 23/resumable.js#188) or it would require to fork resumable.js. Concerning the cookie, it seems possible to use tokens instead (see https://github.com/vsivsi/meteor-file-collection#http-authentication) |
@perak Have you already changed the code? If not, I plan to add a mini api to the uploader (file size, file type filter and single/multiple upload.), an HTML5 thumbnail generator (video & image) and a file preview system based on file types. What do you think I should do?
The second solution would allow re-usability but it would require to make sub-templates in order to avoid loading all the file types filtering and preview code every time. I'm getting better but it wont be an easy ride :) By the way, when blaze has a view in a {{# if }} statement, is the subtemplate loaded in the client browser by default, even if not rendered? I would make my proposition less interesting. I'm also not clear on how to integrate it in the form_utils.js file. I would request to make one check per file filter type : I get the file URL string in img src preview, video src preview if available/possible or a placeholder, other files in a placeholder. I am also considering to preview pdf (see here, even if it might be a little overkill). Is it worth making it now or will you change the form validation procedure soon? What do you think? Are you ok with my approach? > generic file api with types field, kitchen gets back only the file URL and provide attached (inherited?) permissions. Another update: I asked file-collection package creator @vsivsi how to get rid of the cookie but it could be not as easy as I said. (see vsivsi/meteor-file-collection#46) |
Yes! That's looking great :) If you have a moment this upcoming week, tell me in what direction to go (see my questions above). I'll work on other topics and switch on uploader as soon as I have your instructions. |
OK. Thank you for your work. Also, it looks like next week I'l have more free time than usual and will focus to help you and to merge your contributions. 👍 |
Hi, I'm the author of meteor-file-collection. It is not necessary to use an HTTP cookie to pass the authentication token during file upload. The HTTP header method works just fine. See my comment here: vsivsi/meteor-file-collection#46 (comment) However, do note that without using a cookie, the only way to restrict HTTP GET access to stored files by Meteor userId is by handling all of your own file transfers using Basically, if you want to just use |
Thank you @vsivsi for detailed info! |
@perak, @vsivsi (in case it would interest you as an example), I added several features to https://github.com/Billybobbonnet/meteor-kitchen-upload-example. This is a fresh repo so you can see the difference with the minimal user account example. First, a few things that need to be said:
Second, the new features:
Third, what is still missing:
Lastly, it was a long but fun day. I would be glad to have your feedback on my way of doing things since I'm a just starting to code in javascript. I'm not a trained developer, I just learned it out of curiosity and mostly with local desktops applications. |
@Billybobbonnet thank you for your efforts. Sorry for my unresponsiveness - I am moving to a new apartment. Please little bit more patience, I am max interested in implementing upload feature into meteor-kitchen, and your work is great contribution. |
Thanks @perak. Take your time and enjoy your new apartment 😄 . I'll wait for your feedback. |
damn, looks like i lost the right version of .meteor folder. Current repo is working but I encounter some duplicate id errors from mongo leading to extra 403 errors. I'll make a fresh version of it manually later. |
@Billybobbonnet FWIW, I've successfully made the upload |
@vsivsi that's wonderful! |
@vsivsi this is great! And it looks like you had not to fork resumable, you kept it as a submodule and changed file-collection. It's even better 😄 I'll try your branch asap to test it. |
@perak I have made (yet) another fresh repo with the right code. (see https://github.com/Billybobbonnet/meteor-kitchen-upload-example) @vsivsi I tried and managed to edit your package code directly inside my .meteor folder but meteor always restore the former version when the project is built. I guess I'll have to wait for your release. |
If you manually edit the versions file in your app's meteor directory, you can specify |
Just to close the loop on this, file-collection released version 1.1.0 with the above referenced changes last week. Enjoy! |
@vsivsi just in time! Thanks. |
@Billybobbonnet at last! I just uploaded version 0.9.39 with upload support. At the end, I decided to use CollectionFS. Upload feature is not perfectly implemented yet (especially front-end) but it works :) You can see live example here: http://generator-upload.meteor.com/ :) |
nice job @perak ! This is looking clean. Have you tried cfs-ui for the progress bar? Will you use collectionFS for s3 as well? (it would require to pipe all your uploads through your servers) One quick feedback too: it does not work on firefox (last version) yet. I let a failed upload with "what is coding" as title. Anyway, this is nice to see this happening :-) congrats mate! ps: feel free to close the isue, or tell me if you want to. |
Very Very interesting, |
I am thinking of something basic to add a picture to a user profile, similar to what meteoris provide (using collectionFS with the gridFS adapter). A progress bar would be great.
I could include it in the admin panel example (or a dedicated one) if you want.
The text was updated successfully, but these errors were encountered: