Uploadify File Upload method_javascript tips-js tutorial

Source: Internet
Author: User
Uploadify is an upload plug-in of JQuery. It achieves very good results with progress display. Next, we will introduce the Uploadify File Upload method through this article, which involves the usage of Uploadify in Aspnet. This article introduces in detail and has reference value, if you need to learn it together, Uploadify is an upload plug-in of JQuery, which achieves very good results and displays the progress. However, the official php version of the instance is provided. This article describes how to use Uploadify in Aspnet. You can also click the link below to demonstrate or download it.

First, we will show you:

Modify:

You cannot find the uploadify-cancel.png file. Find uploadify.css and find. uploadify-queue-item. cancel a {. Modify the file path.
Many people say that an upload error occurs because the session cannot be obtained when uploadify is used in chrome or Firefox. Manually append the session id Method to the parameter. But I didn't do this here, and it's okay to upload it in chrome or Firefox. I don't know why, maybe it's because I use the latest version.

Key points:

The js configuration of uploadify is comprehensive. You can delete some methods and attributes when using it.

Generally, only onSelect, onUploadError, and onUploadSuccess are considered for uploading a single file.

For multi-File Upload, The onQueueComplete listening to the entire queue is added on the basis of a single file upload.

Start uploading all files: $ ('# file_upload'). uploadify ('upload ','*');

Cancel upload: $ ('# file_upload'). uploadify ('cancel', parm );

Parm is empty: Cancel uploading the first file.

Parm is '*': cancels all uploaded files.

Parm is file id: cancel the file corresponding to this file id.

Modify some additional variables: $ ('# file_upload '). uploadify ("settings", "formData", {"name1": "Chinese name", "parm1": "modified parameter"}); the parameter is json, if a variable in the json file already exists, the property is overwritten. If not, the property is appended.
The server sets the encoding to: upload. setHeaderEncoding ("UTF-8");, so the parsed file name is called normal Chinese. However, the added variable for parsing is garbled in Chinese. Here we perform a transcoding (the transcoding is always relatively low and I don't know where the configuration is wrong ). New String (item. getString (). getBytes ("iso8859-1"), "UTF-8 ")

The storage path of the last returned file on the server (the returned content can be defined here ).

Steps:

Configure uploadify

<% @ Page language = "java" contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %> <% String path = request. getContextPath (); %> <% String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %>
 
 
 

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.