0

am using jquery_form to upload file to express server,it works.but without progress bar.so please help add the progress bar.and am sure a lot of people also need this.

so here is the code

client side:

$('#uploadvideoform').ajaxSubmit({
            error:function(xhr){
                alert(xhr);
            },
            success:function(response){
                var videopath = response.path;
                var videoview  = "<video width='320' height='240' controls='controls'>";
                    videoview += "<source src="+videopath+" type='video/mp4' />";
                    videoview += "Your browser does not support the video tag.";
                    videoview += "</video>";
                $('#view_product_video_content').append(videoview);
            },
        })

    return false;

server side:

exports.upload = function(req, res){
 var serverPath = 'Temp\\' + req.files.productvideo.name;

 // console.log('req.files.productvideo.path '+req.files.productvideo.path)
 // console.log('F:\\unit2\\'+serverPath);
 require('fs').rename(
  req.files.productvideo.path,
  'F:\\unit2\\'+serverPath,
  function(error){
    if(error){
      console.log(error)
      return;
    }

    res.send({
      path:serverPath,
    });

  });

};

paynestrike
  • 4,348
  • 14
  • 46
  • 70

1 Answers1

0

You could use a normal XMLHttpRequest. It is supported by all modern browsers, except the current IE. Have a look at the examples:

Community
  • 1
  • 1
zemirco
  • 16,171
  • 8
  • 62
  • 96