JQuery AjaxUpload를 사용하여 이미지를 업로드하고 업로드 된 이미지로 이미지 컨트롤을 업데이트하려고했지만 ViewState를 설정할 수없는 경우에도 코드가 작동하지 않습니다. 나는 왜 그것이 일어나고 있는지 알고 싶다.
JQuery AjaxUpload 이후에 서버 컨트롤이 업데이트되지 않았습니다.
HttpPostedFile hpfFile = Request.Files["myfile"];
if (hpfFile != null)
{
hpfFile.SaveAs(Server.MapPath("~/ajaxUpload/" + hpfFile.FileName));
img.Src = Server.MapPath("~/ajaxUpload/" + hpfFile.FileName);
}<br>
나를 왜 "img.Src"업데이트되지를 알려 주시기 바랍니다
**Javascript:**<br>
<script type="text/javascript"> /*<![CDATA[*/<br>
$(document).ready(function() {<br>
/* Example 1 */<br>
var button = $('#button1'), interval;<br>
new AjaxUpload(button, {<br>
action: 'fileupload.aspx',<br>
name: 'myfile',<br>
onSubmit: function(file, ext) {<br>
// change button text, when user selects file<br>
button.text('Uploading');<br>
// If you want to allow uploading only 1 file at time,<br>
// you can disable upload button<br>
// this.disable();<br>
// Uploding -> Uploading. -> Uploading...<br>
interval = window.setInterval(function() {<br>
var text = button.text();<br>
if (text.length < 13) {<br>
button.text(text + '.');<br>
} else {<br>
button.text('Uploading');<br>
}<br>
}, 200);<br>
},<br>
onComplete: function(file, response) {<br>
button.text('Upload');<br>
window.clearInterval(interval);<br>
// enable upload button<br>
this.enable();<br>
// add file to the list<br>
$('<li></li>').appendTo('#example1 .files').text(file);<br>
// document.getElementById('img').src = 'C:\\Documents and <br>Settings\\Kavita\\My Documents\\Visual Studio 2008\\WebSites\\WebSite2\\ajaxUpload\\' + file;<br>
// alert(document.getElementById('img').src);<br>
}<br>
});<br>
}); /*]]>*/</script><br><br>
fileupload.aspx.cs 코드 : 아래 코드?