Home > Web Front-end > JS Tutorial > Detailed explanation of jquery uploadify file upload_javascript skills

Detailed explanation of jquery uploadify file upload_javascript skills

WBOY
Release: 2016-05-16 17:16:38
Original
881 people have browsed it

After searching online for a day, everyone said that Uploadify’s only shortcoming is that it does not support Chinese buttons. Before that, I took a look at Uploadify’s API and found a few parameters that were not mentioned by everyone. This is the solution. The key to this issue. (In the future, we will resolutely develop the habit of checking the API when nothing happens)
Uploadify has a parameter called buttonText. No matter how you change it, it does not support Chinese because the plug-in uses a transcoding method in js to transcode the value of this parameter. Yes, the decoding place is in the swf file, and the code cannot be seen, so this method cannot be used.
Another parameter, rarely mentioned on the Internet, is buttonImg (button image). At this time, you can completely replace the black flash browsing button that comes with the plug-in with an image, as long as your own image is in Chinese , doesn’t this solve the Chinese button problem? If you only add this one, you will find that there is a white area under your button image, which is actually left by the flash. The white area represents the available range of the mouse. This range can be adjusted with width and height. There is also a parameter wmode. Its default value is opaque. Just change it to transparent, which means to make the white area transparent. Use the method just mentioned again and set the key click range to be as large as your picture and it will be completely OK.

I won’t go into the usage of Uploadify. There are many articles on the Internet. The usage is the same as other jquery plug-ins, which is just the placement path of several files.
Attached below is an introduction to some parameters of Uploadify. If you want to see all of them, go to its API file, which is usually included in the downloaded package.

uploader: The relative path of the uploadify.swf file. The swf file is a button with the text BROWSE. When clicked, an open file dialog box pops up. Default value: uploadify.swf.
script: Relative path to the spooler. Default value: uploadify.php
checkScript: The relative path of the background processing program used to determine whether the uploaded selected file exists on the server
fileDataName: Set a name, and the uploaded file is retrieved based on this name in the server processing program data. The default is Filedata
method: submission method Post or Get. The default is Post
scriptAccess: the access mode of the flash script file. If it is set to always for local testing, the default value is: sameDomain
folder: the directory where the uploaded file is stored. .
queueID: The ID of the file queue, which is consistent with the ID of the div that stores the file queue.
queueSizeLimit: When multiple files are allowed to be generated, set the number of selected files. Default value: 999.
multi: Multiple files can be uploaded when set to true.
auto: Set to true and upload directly after selecting the file. If set to false, you need to click the upload button to upload.
fileDesc: This attribute value must be set with the fileExt attribute to be effective. It is used to set the prompt text in the file selection dialog box. For example, if fileDesc is set to "Please select rar docpdf file", the effect of opening the file selection box is as follows:
fileExt: Set the type of file that can be selected, such as: '*.doc;*.pdf;*.rar'.
sizeLimit: The size limit of uploaded files.
simUploadLimit: The number of simultaneous uploads allowed. Default value: 1.
buttonText: Text of the browse button, default value: BROWSE.
buttonImg: The path to browse the image of the button.
hideButton: Set to true to hide the image of the browse button.
rollover: The values ​​are true and false. When set to true, there will be a reversal effect when the mouse moves over the browse button.
width: Set the width of the browse button, default value: 110.
height: Set the height of the browse button, default value: 30.
wmode: Setting this item to transparent can make the flash background file of the browse button transparent, and the flash file will be placed at the top level of the page. Default value: opaque.
cancelImg: Close button icon on each file after selecting the file into the file queue

Uploadify also comes with many parameters, useful methods and callback functions, all in the API. Although it is in English, it is easy to understand, so I won’t go into it here.
The following is the code I used, you can refer to it:

Copy the code The code is as follows:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template