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 + "/"; %>