search
HomeWeb Front-endJS TutorialDetailed explanation of jquery uploadify file upload_javascript skills

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:


要注意的是,我的script属性值是一个请求路径,我发现在我设置了同时上传多个文件后(比如3),并不是每请求一次去上传3个文件,而仍然是执行3次请求,请求一次上传一个文件。这也没办法,uplodify有那么多回调函数,要是一次处理多个,那回调函数的参数就不知道拿哪个了,因为这些参数都不是数组。
也就是说,无论你设置同时上传几个文件,它都会一个一个去请求并上传,只是表面上感觉好像有多个线程同时在处理上传请求一样,只是表象而已。而且如果你把simUploadLimit设置过大就会经常出错,我设置成5的时候经常会有一两个文件上传失败。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python vs. JavaScript: A Comparative Analysis for DevelopersPython vs. JavaScript: A Comparative Analysis for DevelopersMay 09, 2025 am 12:22 AM

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Python vs. JavaScript: Choosing the Right Tool for the JobPython vs. JavaScript: Choosing the Right Tool for the JobMay 08, 2025 am 12:10 AM

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript: Understanding the Strengths of EachPython and JavaScript: Understanding the Strengths of EachMay 06, 2025 am 12:15 AM

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScript's Core: Is It Built on C or C  ?JavaScript's Core: Is It Built on C or C ?May 05, 2025 am 12:07 AM

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.