vue.js fileupload dropzone大文件错误错误

时间:2018-07-17 06:10:33

标签: vue.js cors vue2-dropzone

跨域请求被阻止:“同源起源”策略禁止读取http://127.0.0.1:3000/v0/upload/video处的远程资源。 (原因:CORS请求未成功。)

大文件出现错误,文件上传停止。

///服务器端api已经添加了cors,但是没有运气 router.post('/ video',function(req,res){

res.header("Access-Control-Allow-Origin", "*");

res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

// create an incoming form object
var form = new formidable.IncomingForm();

form.maxFileSize = 8024 * 1024 * 1024;
// specify that we want to allow the user to upload multiple files in a single request
form.multiples = false;

console.log('bytes Recieived'+form.bytesReceived);
// store all uploads in the below directory
form.uploadDir = config.contentPath + config.rawContentDir;

0 个答案:

没有答案