Created
January 12, 2014 19:23
-
-
Save deguchi/8389189 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if !IE]><!--> | |
<form action="/upload" method="post" enctype="multipart/form-data"> | |
<div class="fileinput fileinput-new" data-provides="fileinput"> | |
<div class="input-group"> | |
<div class="form-control uneditable-input span3" data-trigger="fileinput"><i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename">{% if form.value!='' %}{{form.value}}{% endif %}</span></div> | |
<span class="input-group-addon btn btn-default btn-file"><span class="fileinput-new">ファイルを選択</span><span class="fileinput-exists">変更</span><input type="file" name="{{form.name}}" onchange="fileupload(event);"></span> | |
<a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">選択解除</a> | |
</div> | |
</div> | |
</form> | |
<![endif]--> | |
<!--[if IE]> | |
<form action="/upload" method="post" enctype="multipart/form-data"> | |
<input type="file" name="{{form.name}}" onchange="fileupload(event);"></span> | |
</form> | |
<![endif]--> | |
<script type="text/javascript" charset="utf-8"> | |
fileupload = function(event) { | |
var $form, target; | |
target = event.target ? event.target : event.srcElement; | |
$form = $(target).closest('form'); | |
$form.append(csrf_token); | |
return $form.ajaxSubmit({ | |
'success': function(filename) { | |
alert("アップロードしました"); | |
} | |
}); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment