First introduce this plugin, and then talk about the problems you may encounter in use
Ssi-uploader is a jquery image upload plugin, the interface is more beautiful
GitHub Address: Https://github.com/ssbeefeater/ssi-uploader
Demo Address: http://ssbeefeater.github.io/#ssi-uploader/examples
Working with Documents: http://ssbeefeater.github.io/#ssi-uploader/documentation
It doesn't explain how it's used, it's on GitHub, and it's on the official website.
This blog post mainly said two questions, also I encountered when using, follow-up Problems to supplement
1, Chinese display problem (although the official said that support Chinese, but in the JS file source code and did not write this piece)
2. Automatically submit form <form> action address when click to select File
Problem 1 Workaround:
Using a text editor (or any code editor) to open a ssi-uploader.js file, swipe to a few lines of document Finally, you will see only en English, and Greek,
Add the following code to the locale, noting the addition of commas.
,
ZH_CN: { success: ' Success ', sucupload: ' Upload succeeded ', choosefiles: ' Select File ', uploadfailed: ' Upload failed ', Servererror: ' Server internal error ', error : ' Error ', abort: ' Terminate ', aborted: ' Terminated ', files : ' file ', upload: ' Upload ', clear: ' Empty ', drag: ' Drag and drop files here ', sizeerror: ' File $ $ ', exceed the limit size, $ ',//$1=file name, $2=max ie (Example.jpg has has exceed the size limit of 2MB) exterror: ' Unsupported Files of type ',//$1=file extension IE (EXE files is not supported) som eerrorsoccurred: ' Some errors have occurred ' }
And then when you're using it, take note of line fifth
$ (' #ssi-upload '). Ssi_uploader ({ URL: ' # ', preview:false, maxnumberoffiles:1, locale: "ZH_CN" , allowed: [' jpg ', ' gif ', ' txt ', ' png ', ' PDF '] });
Problem 2 Workaround:
I didn't find the root cause, but I found a way to solve it.
First, in the HTML document, add the attribute data-validate= "required:" to input, that is, no value
<input data-validate= "required:" type= "file" multiple id= "Ssi-upload"/>
Then modify the 67 line of the Ssi-uploader.js file to
$input. On ("Change", function () {//choose files thiss.touploadfiles (this.files); $input. Val ('); });
Switch
$input. On ("Change", function () {//choose files thiss.touploadfiles (this.files); $input. Val (' a '); });
This problem information on the Internet is relatively small, so I hope to help you, follow-up problems will be added
Reprint Please specify address thank you
Ssi-uploader Upload Image plugin, click the Select File button to automatically submit a form solution