http://blog.csdn.net/u012526194/article/details/69937741
Bootstrap fileinput Chinese API finishing
This time do project use to bootstrap fileinput plugin upload file, in the use of the process, the Internet can be found in the API is not very full, so want to organize a more detailed document, to facilitate their future use, but also hope to bring help to everyone, if there is a mistake, I hope we can correct. I. Introduction of documents
<link href= ". /css/bootstrap.min.css "rel=" stylesheet ">
<link href= ". /css/fileinput.css "media=" All "rel=" stylesheet "type=" Text/css "/>
<scriptsrc= ". /js/jquery-2.0.3.min.js "></script>
<script src= ". /js/fileinput.js "type=" Text/javascript "></script>
<script src= ". /js/bootstrap.min.js "type=" Text/javascript "></script> II, initialization settings:
$ ("#uploadfile"). Fileinput ({
Language: ' en ',//Set language
Uploadurl: "Http://127.0.0.1/testDemo/fileupload/upload.do",//uploaded address
Allowedfileextensions: [' jpg ', ' gif ', ' PNG '],//received file suffix
uploadextradata:{"id": 1, "fileName": ' 123.mp3 '},
Uploadasync:true,//default asynchronous upload
Showupload:true,//whether to show the upload button
Showremove:true,//Show Remove button
Showpreview:true,//whether to show the preview
showcaption:false,//whether the caption is displayed
Browseclass: "Btn btn-primary",//button style
dropzoneenabled:false,//whether to show drag areas
MINIMAGEWIDTH:50,//minimum width of picture
minimageheight:50,//The minimum height of a picture
maximagewidth:1000,//the maximum width of a picture
Maximum height of maximageheight:1000,//picture
maxfilesize:0,//Unit is KB, if 0 indicates no limit to file size
minfilecount:0,
Maxfilecount:10,//indicates the maximum number of files allowed to be uploaded simultaneously
Enctype: ' Multipart/form-data ',
Validateinitialcount:true,
Previewfileicon: "<iclass= ' Glyphicon glyphicon-king ' ></i>",
Msgfilestoomany: "The number of files selected for upload ({n}) exceeds the maximum allowable value of {m}." ",
}. On ("fileuploaded", function (event, data, Previewid, index) {
}); Third, the Options description:
Property name |
Property type |
Description description |
Default value |
Language |
String |
Multi-language settings, the use of the need to introduce the \locales folder in advance of the corresponding language files, Chinese en, the introduction of language files must be placed after fileinput.js |
' En ' |
Showcaption |
Boolean |
Show Introduction to Selected Files |
True |
Showbrowse |
Boolean |
Whether to show the browse button |
True |
Showpreview |
Boolean |
Whether to show the preview area |
True |
Showremove |
Boolean |
Whether to show removal buttons |
True |
Showupload |
Boolean |
Whether to show the upload button |
True |
Showcancel |
Boolean |
Whether to show the Cancel button |
True |
Showclose: |
Boolean |
Whether to show the Close button |
True |
Showuploadedthumbs |
Boolean |
|
True |
Browseonzoneclick |
Boolean |
|
False |
Autoreplace |
Boolean |
Whether the current picture is automatically replaced, and when set to True, the file is selected again, replacing the current file. |
False |
Generatefileid |
Object |
|
Null |
Previewclass |
String |
Add a Preview Button class property |
‘’ |
Captionclass |
String |
|
‘’ |
Frameclass |
String |
|
' Krajee-default ' |
MainClass |
String |
|
' File-caption-main ' |
Maintemplate |
Object |
|
Null |
Purifyhtml |
Boolean |
|
True |
Filesizegetter |
Object |
|
Null |
Initialcaption |
String |
|
'' |
Initialpreview |
Array/object |
|
[] |
Initialpreviewdelimiter |
String |
|
'*$$*' |
Initialpreviewasdata |
Boolean |
|
False |
Initialpreviewfiletype |
String |
|
' Image ' |
Initialpreviewconfig |
Array/object |
|
[] |
Initialpreviewthumbtags |
Array/object |
|
[] |
Previewthumbtags |
Object |
|
{} |
Initialpreviewshowdelete |
Boolean |
|
True |
Removefrompreviewonerror |
Boolean |
|
False |
DeleteUrl |
String |
Request path when deleting picture |
'' |
Deleteextradata |
Object |
Additional incoming parameters when you delete a picture |
{} |
Overwriteinitial |
Boolean |
|
True |
Previewzoombuttonicons |
Object |
|
{ Prev: ' <i class= ' Glyphicon glyphicon-triangle-left ' ></i> ', Next: ' <i class= ' Glyphicon glyphicon-triangle-right ' ></i> ', Toggleheader: ' <i class= ' Glyphicon glyphicon-resize-vertical ' ></i> ', Fullscreen: ' <i class= ' Glyphicon glyphicon-fullscreen ' ></i> ', Borderless: ' <i class= ' Glyphicon glyphicon-resize-full ' ></i> ', Close: ' <i class= ' Glyphicon glyphicon-remove ' ></i> ' }, |
Previewzoombuttonclasses |
Object |
|
{ Prev: ' Btn btn-navigate ', Next: ' Btn btn-navigate ', Toggleheader: ' btn btn-default btn-header-toggle ', Fullscreen: ' Btn btn-default ', Borderless: ' Btn Btn-default ', Close: ' Btn Btn-default ' }, |
Prefericonicpreview |
Boolrean |
|
False |
Prefericoniczoompreview |
Boolrean |
|
False |