Comparing version 0.0.44 to 0.0.45
@@ -545,3 +545,3 @@ var widgets = require('./widgets'), | ||
options.widget = options.widget || widgets.FileWidget; | ||
this.directory = options.upload_to || require('path').join(__dirname,'..','public','cdn'); | ||
this.directory = options.upload_to || require('path').join(__dirname,'..','..','public','cdn'); | ||
this._super(options); | ||
@@ -576,3 +576,3 @@ }, | ||
if(knox) | ||
if(knox&&client) | ||
{ | ||
@@ -584,4 +584,8 @@ var stream = fs.createReadStream(req.files[self.name].path); | ||
fs.unlink(req.files[self.name].path); | ||
self.value = {path:res.socket._httpMessage.url,size:req.files[self.name].size}; | ||
self.value = { | ||
path:res.socket._httpMessage.url, | ||
url:res.socket._httpMessage.url, | ||
size:req.files[self.name].size}; | ||
console.log(res); | ||
console.log(res.socket._httpMessage.url); | ||
on_finish(); | ||
@@ -591,15 +595,17 @@ }); | ||
else | ||
on_finish(); | ||
{ | ||
var is = fs.createReadStream(req.files[self.name].path); | ||
// var is = fs.createReadStream(req.files[self.name].path); | ||
var filename = self.create_filename(req.files[self.name]); | ||
var os = fs.createWriteStream(self.directory + filename); | ||
// var os = fs.createWriteStream(self.directory + filename); | ||
util.pump(is, os, function(err) { | ||
fs.unlink(req.files[self.name].path,function(err) | ||
{ | ||
self.value = {path:filename,url:'/cdn/' + filename,size:req.files[self.name].size}; | ||
on_finish(); | ||
}); | ||
}); | ||
} | ||
// util.pump(is, os, function(err) { | ||
// fs.unlink(req.files[self.name].path,function(err) | ||
// { | ||
// self.value = {path:filename,size:req.files[self.name].size}; | ||
// on_finish(); | ||
// }); | ||
// }); | ||
} | ||
@@ -606,0 +612,0 @@ else |
{ | ||
"name": "j-forms", | ||
"description": "jewish forms creation from fields or from mongoose models", | ||
"version": "0.0.44", | ||
"version": "0.0.45", | ||
"author": "Ishai Jaffe <ishai@empeeric.com>", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
252892
3849
33