zoukankan      html  css  js  c++  java
  • uploadify上传图片

    1、实现源码

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        
        <title>uploadify上传图片</title>
        
    	<meta http-equiv="pragma" content="no-cache">
    	<meta http-equiv="cache-control" content="no-cache">
    	<meta http-equiv="expires" content="0">    
    	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    	<meta http-equiv="description" content="This is my page">
    	<link type="text/css" rel="stylesheet" href="../../js/uploadify/uploadify.css"/>
    	<script type="text/javascript" src="../../js/jquery-1.12.3.js"></script>
    	<script type="text/javascript" src="../../js/uploadify/jquery.uploadify.js"></script>
    	<script type="text/javascript">
    		$(function(){
    			 $("#upload").uploadify({
    			    'height': 25,
                    'width': 100, 
    		        'auto': true,
    		        'removeTimeout' : 10,
    		        'buttonText': '上传图片',
    		        'fileTypeExts': '*.gif; *.jpg; *.png',
    		        'fileSizeLimit' : '1MB',
    		        'swf': '../../js/uploadify/uploadify.swf',
    		        'uploader': '../../js/uploadify/uploadify.php',
    		        'cancelImg': '../../js/uploadify/uploadify-cancel.png',
    		        'buttonImage' : '../../images/img.PNG',
    		        'multi': false,
    		        'onUploadSuccess':function(file){
    		             console.log(file.name);
                         $("#imgs").css("display","block");
                         $("#imgs").attr("src",file.name);
                    }
    		    });
    		});
    	</script>
    
      </head>
      
      <body>
         <input type="file" name="upload" id="upload" />
         <img id="imgs" style="100px; height: 100px; display: none;">
      </body>
    </html>
    

    2、实现结果


  • 相关阅读:
    看Web视频整理标签笔记
    公文流转系统进度
    文件和流课堂实验三
    文件和流课堂实验二
    2018/10/21动手动脑
    第二次实验报告动手动脑
    2018.10.11上课进度说明
    原码反码补码
    课上动手动脑总结
    Java实验一——习题册+登陆界面 总结
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13314205.html
Copyright © 2011-2022 走看看