0
jquery 및 웹 핸들러를 사용하여 서버에 파일을 업로드하려고합니다. 모든 문제는 없지만 문제는 파일 업로드 창에서 파일 업로드 컨트롤을 클릭하면 바로 파일 업로드를 시작한 파일을 선택한 후입니다. 내 문제는 다른 컨트롤의 클릭 이벤트 (예 : 버튼 클릭 이벤트)에서 파일을 업로드하고 싶습니다.업로드 버튼에서 파일 업로드가 작동하지 않습니다.
여기에 제가 현재 작업하고있는 코드가 있습니다.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="jquery.ajax_upload.0.6.min.js" type="text/javascript"></script>
<link href="default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
$(document).ready(function() {
var button = $('#fuAttachment'), interval;
$.ajax_upload(button, {
action: 'FileUploader.ashx',
name: 'myfile',
onSubmit: function (file, ext) {
if (ext == "jpg") {
return true;
}
else {
alert("Invalid File Type.");
return false;
}
// this.disable();
},
onComplete: function (file, response) {
window.clearInterval(interval);
$('<li></li>').appendTo('.files').text(file);
}
});
});
</script>
</head>
<body>
<form>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="web_dialog_title">
<asp:Label ID="Label2" Text="Add Attachment" runat="server"></asp:Label>
</td>
<td class="web_dialog_title align_right">
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblAtchTitle" runat="server" Text="Attachment :"></asp:Label>
</td>
<td>
<input type="file" id="fuAttachment" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblAtchType" runat="server" Text="Type :"></asp:Label>
</td>
<td>
<select id="ddlAtchType" runat="server">
</select>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblAttachDesc" runat="server" Text="Description :"></asp:Label>
</td>
<td>
<textarea id="txtAttachDesc" runat="server" cols="13" rows="4"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Button ID="btnAddAttach" runat="server" Text="Attach" />
<input type="submit" runat="server" name="Submit" value="Submit" id="btnSub" />
</td>
<td>
<input type="reset" value="Reset" id="btnAttachReset" name="Reset" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<ol class="files">
</ol>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
는 내 업로드 프로세스가 btnSub
클릭 이벤트를 시작해야합니다. 누구보다 알고있는 경우
uploadify jQuery를 사용할 수 있습니다 ......... 좀 도와주세요 form' 태그를 사용하려면'enctype = "multipart/form-data"' –