uploadify 上传文件并带有随机数文件名生成
uploadify 上传文件并带有随机数文件名生成
夕阳依旧 发表于10个月前
uploadify 上传文件并带有随机数文件名生成
  • 发表于 10个月前
  • 阅读 5
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 十分钟定制你的第一个小程序>>>   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="/jscss/jquery-1.9.1.min.js"></script>
    <link rel="stylesheet" href="../../js/uploadify.css" type="text/css" />
    <script type="text/javascript" src="../../js/swfobject.js"></script>
    <script type="text/javascript" src="../../js/jquery.uploadify.js"></script>
    <script language="javascript" type="text/javascript">
        
        var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

	    function generateMixed(n) {
		     var res = "";
		     for(var i = 0; i < n ; i ++) {
			     var id = Math.ceil(Math.random()*35);
			     res += chars[id];
		     }
		     return res;
	    }



        $(function () {
            $('#uploadify').uploadify({
                'swf': '../../Upload/uploadify.swf',
                'uploader': '/user/PanoEditor/PanoSetting.ashx',
                'fileObjName': 'Filedata',
                'queueID': 'fileQueue',
                'formData': { 'key': 'upImg', 'panoId': '<%=Request.QueryString["pid"]%>', 'sceneID': '<%=Request.QueryString["sid"] %>','fileNumName': generateMixed(12) },
                'auto': false,
                'fileSizeLimit': '0',
                'onUploadError': function (file, errorCode, errorMsg, errorString) {
                    alert('The file ' + file.name + ' could not be uploaded: ' + errorMsg);
                },1. 这里是列表文本
                'onUploadComplete': function (file) {
                    parent.hotSpot.hotImg = 
                },
                'onUploadProgress': function (file, bytesUploaded, bytesTotal, totalBytesUploaded) {
                    //$("#divFix").html(bytesUploaded + "/" + totalBytesUploaded);
                }
            });
        });

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input type="file" name="uploadify" id="uploadify" />
        <div id="fileQueue">
        </div>
        <div class="upld">
            <ul>
                <li class="up"><a href="javascript:$('#uploadify').uploadify('upload','*')">上传</a></li>
                <li class="cel"><a href="javascript:$('#uploadify').uploadify('cancel','*')">取消上传</a></li>
            </ul>
        </div>
    </div>
    </form>
</body>
</html>
`
共有 人打赏支持
粉丝 0
博文 9
码字总数 7725
×
夕阳依旧
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: