zoukankan      html  css  js  c++  java
  • swf上传文件

    以下是自学it网--中级班上课笔记

                网址:www.zixue.it

    引入的js包自己在网上找一个,这里好像不支持上传文件,反正我没找到,呵呵~~

    html文件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
    <head>
    <title>swf文件上传</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <script type="text/javascript" src="./swf/swfupload.js"></script>
    <script type="text/javascript">
    // 写配置,就像.ini,.conf
    var setting = 
    {
    upload_url:'upfile.php', //后后接收的地址
    flash_url: './swf/Flash/swfupload.swf', // swf上传插件主文件
    file_post_name: 'pic',
    file_types : "*.jpg;*.gif",// 限制文件类型
    button_placeholder_id:'upload', // 插件初始化之后所占的对象位置
    button_'200px',
    button_height:'40px',
    button_text:'请选择文件',
    upload_success_handler : function(file,data) {
        if(data == 'OK') {
            alert('上传成功');
        }
    },
    upload_progress_handler: function(file,complete,total) {
        document.getElementById('progress').innerHTML = complete/total;
    }
    };
    
    var swfu = null;
    window.onload = function() {
        // 页面加载完毕,就初始化swf对象
        swfu = new SWFUpload(setting);
    }
    
    </script>
    
    <style type="text/css">
    </style>
    </head>
        <body>
            <div id="progress"></div>
            <div id="upload"></div>
            <input type="button" value="上传" onclick="swfu.startUpload();" />
        </body>
    </html>


    upfile.php

    echo move_uploaded_file($_FILES['pic']['tmp_name'],'./upload/' . $_FILES['pic']['name']) ? 'OK':'fail';
    


    如图:


  • 相关阅读:
    Python接口测试学习笔记(五)
    Python接口测试学习笔记(四)
    Python接口测试学习笔记(三)
    Python接口测试学习笔记(二)
    Caused by: java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
    Linux虚拟机安装MySQL8.0数据库
    剑指offer题解02-10
    Git使用的常用命令
    使用IDEA整合SSM框架
    IntelliJ IDEA 连接数据库 详细过程
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3143208.html
Copyright © 2011-2022 走看看