Atitit file Upload architecture design implementation mechanism solution practice java php c #. net js javascript c ++ python Atitit file Upload architecture design implementation mechanism solution practice java php c #. net js javascript c ++ python
1. requirements for uploading 2
1. local Preview 2
1. 2. 2. refreshing 2
1. 3. 3. progress display 2
1. 4. resumable Upload 2
1. 5. Cross-bs cs 2
1. 6. with progress bar 2
. Complete the prompt animation effect... 2
2. standardized api attributes 2
3. implementation principle using the FormData object, you can use a series of key-value pairs to simulate a complete form, and then use XMLHttpRequest to send this "form". 3
4. if you need to display the progress bar, you need to use the Ajaxj technology to display the file upload progress in real time .. up to the iframe blackhead .. the actual principle is to write the upload progress information such as the total length of the file, the number of uploaded files, and the transfer rate to the session while processing the uploaded files, the client browser uses Ajax technology to create a new independent process to obtain the upload progress information from the session and display it in real time. Ajax technology can obtain server data without refreshing a new page. Sessions can be viewed as server memory and can be used to store a small amount of customer information. 3
5. Php implementation 4
5. 1. differences between Java and php 4
6. AtiUpload 5
7. refer to 5
1. requirements for Uploading: 1.1. local preview 1.2. 2. refreshing new 1.3. 3. the progress shows 1.4. resumable Upload 1.5. across bs cs 1.6. with progress bar 1.7. complete the prompt animation effect ..
Author: Nickname: old Wow's Paw (full name: Attilax akbar al rapanui Attila AKBA Arla Panui) Name: Ai long, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://www.cnblogs.com/attilax/
2. standardize api attributes
The textbox name specified for backfilling.
CallbackQ11 default answer function
Callback specifies the Callback function
3. implementation principle using the FormData object, you can use a series of key-value pairs to simulate a complete form, and then use XMLHttpRequest to send this "form ".
This is a class provided by XMLHttpRequest 2.0.
You can also use jQuery to send FormData, but you must set the relevant options correctly:
4. if you need to display the progress bar, you need to use the Ajaxj technology to display the file upload progress in real time .. up to the iframe blackhead .. the actual principle is to write the upload progress information such as the total length of the file, the number of uploaded files, and the transfer rate to the session while processing the uploaded files, the client browser uses Ajax technology to create a new independent process to obtain the upload progress information from the session and display it in real time. Ajax technology can obtain server data without refreshing a new page. Sessions can be viewed as server memory and can be used to store a small amount of customer information.
Upload listener commons-fileupload version 1.2 supports Upload listening. you only need to implement a listener and add it to the upload component. The listener needs to implement its progresslistener
5. Php implementation
The temporary copy file will disappear at the end of the script. To save the uploaded file, we need to copy it to another location:
If (isset ($ _ POST ['upload']) {
Var_dump ($ _ FILES );
/// The third parameter is "true", indicating that a multi-level directory can be created. iconv prevents Chinese Directory garbled characters.
// $ Res = mkdir (iconv ("UTF-8", "GBK", $ path), 0777, true );
$ F = dirname (_ FILE _). '/up_tmpx2/'.time().'.jpg ';
Mkdir (dirname ($ f), 0777, true); move_uploaded_file ($ _ FILES ['upfile'] ['tmp _ name'], $ f );
// Header ('Location: test. php ');
Exit;
5.1. differences between Java and php
Php needs to move memory files to temporary files
Direct stream writing of Jva
6. AtiUpload
7. Reference
Implementation and design of atitit. ajax file upload-attilax column-blog channel-CSDN.NET.htm
Atitit. jquery ajax html5 uploads image files