- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
课件播放系统组件使用方法课件播放系统组件使用方法
搭建课件上传下载及播放文件上传模块前台页面提交文件前台页面验证脚本scriptlanguage= JavaScript type=text/javascript charset=UTF-8$(document).ready(function(){$(document.form).submit(function(){varfile=(document.getElementById(file)).value;varname= .ppt;if((file.indexOf(name,file.length-4))0){alert(文件格式不对!请重新选择);returnfalse;}returntrue;});});/scripts:formaction=addPPt method=post enctype=multipart/form-data id=form name=form请选择需上传的教学课件(课件格式为PPT):inputtype=file name=uploadFile size=70 id=file/inputtype=reset value=重置inputtype=submit value=提交/s:form后台上传模块publicclass AddVideoAction extends ActionSupport{privatestaticfinallongserialVersionUID = 1L;privatestaticfinalintBUFFER_SIZE = 8 *1024;private File uploadFile;private VideoService vs;private String uploadFileFileName;private String uploadFileContentType;public VideoService getVs() {returnvs;}publicvoid setVs(VideoService vs) {this.vs = vs;}//上传到服务器privatestaticvoid copy(File src,File dst){try{InputStream in = null;OutputStream os = null;try{in = new BufferedInputStream(new FileInputStream(src));os = new BufferedOutputStream(new FileOutputStream(dst),BUFFER_SIZE);byte []buffer = newbyte[BUFFER_SIZE];while( in.read(buffer) 0){os.write(buffer);}}finally{if(null != in){in.close();}if(null != os){os.close();}}}catch (Exception e){e.printStackTrace();}}public String execute()throws Exception{SimpleDateFormat sdf = new SimpleDateFormat(yyyyMMddHHmmss);if(null==ActionContext.getContext().getSession().get(currentAdmin))returnlogin;String fileName = uploadFileFileName;fileName = fileName.replace( ,);String playFileName = sdf.format(new Date())+.flv;File playFile = new File(ServletActionContext.getServletContext().getRealPath(/upload/video/play) + \\ + playFileName);File downloadFile = new File(ServletActionContext.getServletContext().getRealPath(/upload/video/download) + \\ + fileName);copy(uploadFile,downloadFile);copy(uploadFile,playFile);if( 1 == vs.addVideo(downloadFile,playFileName))returnSUCCESS;returnERROR;}//文件的扩展名publicstatic String getExtention(String
文档评论(0)