標籤:end document text files src index tps asi show
參考:
https://www.cnblogs.com/landeanfen/p/5007400.html
bootstrap-fileinput源碼:https://github.com/kartik-v/bootstrap-fileinput
bootstrap-fileinput線上API:http://plugins.krajee.com/file-input
bootstrap-fileinput Demo展示:http://plugins.krajee.com/file-basic-usage-demo
<script src="/static/vendors/kartik-v-bootstrap-fileinput-3540936/js/plugins/piexif.min.js" type="text/javascript"></script><script src="/static/vendors/kartik-v-bootstrap-fileinput-3540936/js/plugins/sortable.min.js" type="text/javascript"></script><script src="/static/vendors/kartik-v-bootstrap-fileinput-3540936/js/plugins/purify.min.js" type="text/javascript"></script><script type="text/javascript" src="/static/vendors/kartik-v-bootstrap-fileinput-3540936/js/fileinput.min.js"></script>
<form id="fileuploadform" enctype="multipart/form-data"> <div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback"> <label class="control-label col-md-3 col-sm-12 col-xs-12" >選擇檔案</label> <div class="col-md-9 col-sm-12 col-xs-12"> <input id="input-id" type="file"> </div> </div>
$(document).ready(function () { $("#input-id").fileinput({ showUpload:true, uploadLabel: "xxx", uploadTitle: "xxxx", allowedFileExtensions: [‘xlsx‘], maxFileSize: 10000, maxFilesNum: 1, uploadUrl: "xxxx", //showPreview:false, enctype: ‘multipart/form-data‘, ajaxSettings: { type: "POST", headers: header,}, uploadExtraData: function (previewId, index) { var obj = {}; obj["xxx"]=$("#xxx").val() return obj; }, }); });
perfFile = request.FILES.get("file_data", None) # 擷取上傳的檔案,如果沒有檔案,則預設為None if not perfFile: result["error"] = "no uploaded files found" return Response(result)
檔案上傳組件使用。