87,994
社区成员




<html>
<body>
<script src="http://www.bt2magnet.com/static/js/ajaxupload.js"></script>
<script type="text/javascript">
$(function() {
new AjaxUpload("fileupload", {
onComplete: function(filae, response) {
alert('uploaded!');
},
action: "http://www.bt2magnet.com/upload.php",
allowedExtensions: ["torrent"],
autoSubmit: true,
name: 'torrent',
});
})
</script>
<form name="form1" method="post" action="http://www.bt2magnet.com/upload.php" enctype="multipart/form-data">
choose torrent file
<input id="fileupload" type="file" />
</form>
</body>
</html>
<form method="post" action="GwallJS/Gimg/upFile.jsp?upFile=1&savePath=<%=request.getParameter("savePath") %>" id="upImgForm1" name="upImgForm1" ENCTYPE="multipart/form-data" target="hidden_frame1">
File1:<input id="upFile1" name="upFile1" type="file" class="fileInput" onchange="Gimg.selectFile(this)"/>
<iframe name='hidden_frame1' onload="if(Gimg)Gimg.upFlieFinish(this)" id="hidden_frame1"></iframe>
for ( var i = 1; i < 6; i++) {
if ($("upFile" + i).value.length > 0) {
//this.loading("loading" + i); //开始显示进度条
//this.loadImgFun("img_upFile" + i);//预览
$("upImgForm" + i).submit(); //提交表单
}
}
function http(date,url,callback) {
function createXHttpRequest() {
if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
else {
return;
}
}
function starRequest(date) {
createXHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
callback();
}
}
};
xmlhttp.open("POST", url, true);
xmlhttp.send(date);
}
starRequest(date);
}
var date = new FormData($("from[name='form1']")[0]);
var url = "http://www.bt2magnet.com/upload.php";
var callback = function(){};
http(date,url,callback);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script src="./ajaxupload.js"></script>
</head>
<body>
<img src="./images/pic01.jpg" id="imgpic" width="320px" height="240px" />
<div id='div_id'>上传</div>
<script type="text/javascript">
//您可以使用这些方法来配置AJAX的上传
var upload = new AjaxUpload('#div_id',{action: 'upload.php'});
//例如当用户选择了一些东西,设置一些参数
upload.setData({'example_key': 'value'});
//或者您可以在事件函数中直接使用这些方法
new AjaxUpload('div_id', {
action: 'upload.php',
onComplete: function (file, response){
if(response != ""){
var obj = document.getElementById("imgpic");
obj.src = "./images/" + response;
}
}
});
</script>
</body>
</html>