Ssi-uploader Upload Image Plugin, click the Select File button to automatically submit a form solution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.