Code Monkey home page Code Monkey logo

Comments (16)

msio avatar msio commented on May 18, 2024

picture is uploaded server:

Meteor.Files Debugger: [MeteorFileWrite] {name: K8g3CxveXuPCswMhQ, meta:[object Object]}
I20160409-22:51:54.725(2)? Meteor.Files Debugger: Received chunk #1 of 1 chunks, file: dance-icon.png
I20160409-22:51:54.802(2)? Meteor.Files Debugger: [MeteorFileWrite] {name: K8g3CxveXuPCswMhQ, meta:[object Object]}
I20160409-22:51:54.802(2)? Meteor.Files Debugger: Received chunk #-1 of 1 chunks, file: dance-icon.png
I20160409-22:51:54.811(2)? Meteor.Files Debugger: The file dance-icon.png (binary) was saved to ~/interests/K8g3CxveXuPCswMhQ.png

on the client:

Meteor.Files Debugger: [insert()]
files.coffee:878 Meteor.Files Debugger: Connection established continue() upload
files.coffee:884 insert: 121.977ms

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Have you subscribed to this data? Please see this example

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Also you need to change template to:

    {{#if currentFile}}
        Uploading <b>{{currentFile.file.name}}</b>:
        <span id="progress">{{progress}}%</span>
    {{else}}
        <input id="fileInput" type="file"/>
    {{/if}}
    <hr>
    {{#if imageFile}}
         <img src="{{fileURL imageFile}}" alt="{{imageFile.name}}"/>
    {{/if}}

from meteor-files.

msio avatar msio commented on May 18, 2024

server

Meteor.publish('files.images.all', function () {
    return InterestIcons.collection.find({});
});

client

Router.route('/interests/new', {
    name: 'newInterest',
    waitOn: function () {
        return [Meteor.subscribe('InterestType'),Meteor.subscribe('files.images.all')];
    }
});

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Does my comment about template fix this issue?

from meteor-files.

msio avatar msio commented on May 18, 2024

unfortunately no .. looks better

I20160409-22:58:32.321(2)? Meteor.Files Debugger: [findOne("Azyz5KMzneroddsWW")]
I20160409-22:58:32.322(2)? Meteor.Files Debugger: [download(/cdn/storage/InterestIcons/Azyz5KMzneroddsWW/original/Azyz5KMzneroddsWW.png, original)]
W20160409-22:58:32.324(2)? (STDERR) Meteor.Files Debugger: [download(/cdn/storage/InterestIcons/Azyz5KMzneroddsWW/original/Azyz5KMzneroddsWW.png)] [404] File not found

from meteor-files.

msio avatar msio commented on May 18, 2024

but the image is in filesystem I checked it

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Okay, I saw from you previous issue, what you're using path relative to you user (starts with ~)
Could you try to change it to absolute path?

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Or even try to keep package's default (for testing purpose)

from meteor-files.

msio avatar msio commented on May 18, 2024

I have it but I didnt want to publish it ;)

from meteor-files.

msio avatar msio commented on May 18, 2024

It works right know but It finds only one image but I want to display curently uploaded

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Then do something like:

Template.uploadForm.onCreated(function () {
  this.uploadedFile = new ReactiveVar(false);
});

Template.uploadForm.helpers({
  currentFile: function () {
    return Template.instance().currentFile.get();
  },
  uploadedFile: function () {
    return Template.instance().uploadedFile.get();
  }
});

Template.uploadForm.events({
  'change #fileInput': function (e, template) {
    if (e.currentTarget.files && e.currentTarget.files[0]) {
      var file = e.currentTarget.files[0];

      template.currentFile.set(Images.insert({
        file: file,
        onUploaded: function (error, fileObj) {
          if (error) {
            alert('Error during upload: ' + error);
          } else {
            // Two options
            // First (no need for subscription):
            template.uploadedFile.set(fileObj);
            // Second (subscription needed):
            template.uploadedFile.set(InterestIcons.collection.findOne({_id: fileObj._id}));
          }
          template.currentFile.set(false);
        },
        streams: 'dynamic',
        chunkSize: 'dynamic'
      }));
    }
  }
});

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

I'm off for today, will check you reply tomorrow

from meteor-files.

msio avatar msio commented on May 18, 2024

I figured it out with similar implementation .. thanks a lot man :)

from meteor-files.

dr-dimitru avatar dr-dimitru commented on May 18, 2024

Solved? Right?

from meteor-files.

msio avatar msio commented on May 18, 2024

that's right .. thanks for your support :)

from meteor-files.

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.