Sunday, 12 November 2017

Ubuntu Dash Search Engine not working

Use the below command in your terminal to get back show apps :

sudo apt-get purge unity-lens-applications    
sudo apt-get install unity-lens-applications 

Thursday, 28 September 2017

mi-Script




http://www.thetechstuff.in/blog/mi-script-5

var refreshId =setInterval(function(){ console.log("Script Activated --- TheTechStuff --- Clicking"); $("[data-gid=4172400004]").click(); if($("[data-gid=4172400004]").hasClass("btn-disabled")) { }else{ $("[data-gid=4172400004]").click(); clearInterval(refreshId); } },1);

Monday, 18 September 2017

Saturday, 2 September 2017

How to upload multiple image in NODEJS with MULTER

First of all you have to install multer package in your system and then paste text below typed:


var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, path.resolve('public') + '/images/uploads/')
  },
  filename: function (req, file, cb) {
    cb(null, Date.now() + path.extname(file.originalname))
  }
});


Storage variables contains the destination of file upload and filename is the access to change file name if you want , i am changing the filename with current date.

next it 

var upload = multer({
  dest: path.resolve('public') + '/images/uploads/',
  limits: {
    fileSize: 3 * 1024 * 1024,
    files: 20
  },
  storage: storage,
  rename: function (fieldname, filename) {
    return fieldname+"_"+Date.now();
  },
  onFileUploadStart: function (file) {
    console.log(file.originalname + ' is starting to upload');
  },
  onFileUploadComplete: function (file) {
    console.log(file.originalname + ' uploaded to  ' + file.path);
  }
});


paste this code group and write post api and incude upload varialbe to store image to the destination 
.
like 
;



router.post('/imageUpload', function(req,res,next)
{
upload(req,res,function(err){
/* for single image*/
req.file.filename   // filename is the image name stored in database 

/* for multiple images*/
req.files.filename 
});

});




Tuesday, 29 August 2017

SEND DATA WITH MULTIPART/FORM_DATA THROUGH NODE

Use Multer npm Package to parse data in form of form-data , if you don't use this your sended value be a undefinde value in your console, so try this



var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, path.resolve('public') + '/images/uploads/')
  },
  filename: function (req, file, cb) {
    cb(null, Date.now() + path.extname(file.originalname))
  }
});

/**
  Multr Defining Max Image File Size upto 3 MB
  Defining only Single Image Can Upload with key name 'avatar'
*/
var fileUploader = multer({
  dest: path.resolve('public') + '/images/uploads/',
  limits: {
    fileSize: 3 * 1024 * 1024,
    files: 1
  },
  storage: storage,
  rename: function (fieldname, filename) {
    return filename+"_"+Date.now();
  },
  onFileUploadStart: function (file) {
    console.log(file.originalname + ' is starting to upload');
  },
  onFileUploadComplete: function (file) {
    console.log(file.originalname + ' uploaded to  ' + file.path);
  }
}).single('avatar');



and the value cannot be nul after that .....