You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.Videos=newFilesCollection({/* .. other options .. */collectionName: 'Videos',onAfterUpload: function(fileRef){varformats,sourceFile;sourceFile=ffmpeg(fileRef.path).noProfile();formats={ogg: true,mp4: true,webm: true};_.each(formats,function(convert,format){varfile,upd,version;if(convert){file=_.clone(sourceFile);version=file.someHowConvertVideoAndReturnFileData(format);upd={$set: {}};upd['$set']['versions.'+format]={path: version.path,size: version.size,type: version.type,name: version.nameWithExtension,extension: version.extension};returnVideos.update(fileRef._id,upd);}});}});if(Meteor.isClient){Template.upload.events({'change #upload': function(e,template){/* Upload all Files */_.each(e.currentTarget.files,function(file){Videos.insert({file: file,onUploaded: function(error,fileObj){if(error){alert(error.message);thrownewMeteor.Error500,error;}},onBeforeUpload: function(){// Note: You should never trust to extension and mime-type here// as this data comes from client and can be easily substitute// to check file's "magic-numbers" use `mmmagic` or `file-type` package// real extension and mime-type can be checked on client (untrusted side)// and on server at `onAfterUpload` hook (trusted side)if(['ogg','mp4','avi','webm'].inArray(this.ext)&&this.size<512*1048*1048){returntrue;}else{return"Please upload file in next formats: 'ogg', 'mp4', 'avi', 'webm' with size less than 512 Mb. You have tried to upload file with \""+this.ext+"\" extension and with \""+(Math.round((this.size/(1024*1024))*100)/100)+"\" Mb";}}});});}});}