Code on GitHub (https://github.com/andygithubchen/jsUpload), please read it in conjunction with the files on GitHub.
The main implementation of the JS cross-domain upload file, where the cross-domain currently only in two domain names point to the server in the same LAN. Of course, both of these options can be uploaded with the same domain name.
For example:
192.168.1.60 www.test.cn192.168.1.61 www.video.cn
If you want to upload files under the www.test.com domain name under the www.video.com domain name, you can use the following two scenarios:
Scenario one (under the Solution1 folder)
- Copy all files under public to the site root under the www.video.cn domain name
- Copy all files under Solution1 to the site root under the www.test.cn domain name
The browser opens the www.test.cn domain name for uploading. After uploading, there will be a file file in the root directory of the www.video.cn domain name, which has just uploaded files.
This scenario uses Jquery.uploadify.js. Using this scenario, the root directory of the two domain name should have crossdomain.xml file, its configuration can be understood by Google.
Scenario two (under the Solution2 folder)
- Copy all files under public to the site root under the www.video.cn domain name
- Copy all files under Solution2 to the site root under the www.test.cn domain name
The browser opens the www.test.cn domain name for uploading. After uploading, there will be a file file in the root directory of the www.video.cn domain name, which has just uploaded files.
This program is using bui this JS front-end frame, upload the progress of the style can be easily modified, you can go to the Bui official website (http://www.builive.com) to view the manual.
Js cross-domain upload file