jQuery Upload Not Working


#1

I’m trying to use jQuery Upload for the user to be able to upload files to the server. I’m testing it locally at the moment. I don’t get any error messages, but I don’t see any files getting uploaded to the upload folder either.

In a js file on client side:

Template.submitDesign.created = function() {
      Uploader.init(this);
  }

Template.submitDesign.rendered = function () {
  Uploader.render.call(this);
};

Template.submitDesign.events({

 'change #file': function(e) {
    Uploader.startUpload.call(Template.instance(), e);
  }
});

init.js on server:

      Meteor.startup(function () {
	  // init items collection
	  if (Items.find().count() == 0) {
	    Items.insert({name: 'My Item', uploads: []});
	  }

	  UploadServer.init({
	    tmpDir: process.env.PWD + '/.uploads/tmp',
	    uploadDir: process.env.PWD + '/.uploads/',
	    checkCreateDirectories: true,
	    getDirectory: function(fileInfo, formData) {
	      if (formData && formData.directoryName != null) {
	        return formData.directoryName;
	      }
	      return "";
	    },
	    getFileName: function(fileInfo, formData) {
	      if (formData && formData.prefix != null) {
	        return formData.prefix + '_' + fileInfo.name;
	      }
	      return fileInfo.name;
	    },
	    finished: function(fileInfo, formData) {
	      if (formData && formData._id != null) {
	        Items.update({_id: formData._id}, { $push: { uploads: fileInfo }});
	      }
	    }
	  });
	});

html:

     <form id="submit" class="custom" method="POST" enctype="multipart/form-data">
            <div class="row add-attachments">
                <div class="columns text-right" >
                   <label><input id="file" type="file" name="file" multiple="true" data-form-data='{{ submitData }}'><span>+ Add Attachments</span></label>
                </div>
            </div>
           <button class="final" type="submit">Submit</button>
    </form>

#2

It is in .upload folder in main directory if you dont see .upload folder then press ctr+h it is show all hide file


#3

I can see the folder, but there’s nothing in it.


#4

i try whit this package too, but don’t work, i thinks it is for i work in windows and the
`tmpDir: process.env.PWD + ‘/.uploads/tmp’,
uploadDir: process.env.PWD + ‘/.uploads/’,

process.env.pwd don’t work (i try with cfs and this don’t work, i use “…/…/…/…/…/public/img” )
but in jquery upload don’t work, you can solve this?