Methods and questions about using the jquery extension uploadify to upload files, jqueryuploadify
I am a student, and my major is not a computer, but I need to use a lot of related technologies. So I am working hard when the technical foundation is poor. Recently, a small project needs to upload images, and ajax is required. However, the ajax method using jquery always has the "C:/fakepath" problem. I have been searching for related solutions on the Internet for a long time, but it is too troublesome, or my level is not enough. However, some people say they can use jquery's file upload plug-in, So Baidu. Discovery. Here, I will record that, while helping myself learn, if I can help other friends, I am so happy!
The first is the download of uploadify. Baidu directly has two versions on the official website, one is the free flash version, and the other is the html5 version charged for $5. No one offered me reimbursement and chose the former.
You can also choose to add shards ).
The following is the code section!
1 <! DOCTYPE html> 2
<?php$tmp_name=$_FILES["img"]["tmp_name"];$name=$_FILES["img"]["name"];$path="../img";$size=$_FILES["img"]["size"];if(move_uploaded_file($tmp_name,$path.'/'.$name)){ echo "1";}else{ echo "0";}
This is the final result I learned from many blogs and posts on the Internet (I need to pay attention to fileObjName and onUploadSuccess. It is said that they are the names of the new version, and the old versions are fileDataName and onComplete respectively ). The basic functions are implemented. However, during the test, when an upload error occurs, for example, if I select an image that exceeds the size limit, an English prompt will pop up!
So I am in line with the principle that "useful is a good method", in min. search for these sentences in js, and change the fixed part "Some files were not added to the queue:" and "the file", "exceeds the size limit" to Chinese, the effect is as follows:
If any errors or suggestions exist, please point them out! Thank you.