Tuesday, January 15, 2013
jquery File Upload
<script type="text/javascript"
src="http://malsup.github.com/jquery.form.js"></script>
$(document) .ready(
function() {
$('#loading').hide();
$(function() {
$('#myForm').ajaxForm({
dataType : 'json',
beforeSend : function(xhr, o) {
$('#loading').show();
},
success : function(data) {
if (data.status == 0) {
alert('success');
$('#up_down_right').empty();
$('#up_down_right').append('<a href="'+ data.download_url + data.info.file_path+ data.info.file_name+ '">파일 다운 받기</a> ');
}else{
alert('fail' + data.status);
}
$('#loading').hide();
}
});
});
});
<form action="/api/v3/web/setting/create/fileUpload.json"
enctype="multipart/form-data" method="post" name="myForm" id="myForm" >
<label for="myFile">파일선택 : </label>
<input type="file" name="file" id="myFile" />
<input type="submit" value="확인" />
<input type="hidden" name="App-Agent" id="App-Agent"/>
<input type="hidden" name="AKey" id="AKey"/>
<input type="hidden" name="Access-Token" id="Access-Token"/>
</form>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment