Upload file with XMLHTTP

xiaoxiao2021-03-06  88

Write ideas: Send a destination after the client passes the Base64 encoding. During the test process, the upload file is too large, resulting in the timeout unsuccessful. Later, it is improved. Send the encoded segmentation. Test 20M success

Write the purpose: In the traditional solution, select upload once once. But when you read the file path in the database, you will be more troublesome when you get these files to a place. If you get a path to find one FTP is of course possible, but I will take time when I find these files. This is mainly to obtain files through the file path in the database. Put the files once a batch to a place. The main purpose is to exercise himself.

Solution: At first tried to use analog keyboard input forced to assign the File control with a traditional method. However, the situation of the old touched null value, so there are many files that have not been sent. Check out some information, now you take all paths through the database and then write to a JS. Then read these paths with JS in the front desk, send files through XMLHTTP. Because IE doesn't like XMLHTTP. I always think he has malicious behavior. So I will talk about warnings. So the web path cannot be used when operation. You can only use a physical path to access it. Then there is a file to receive these encodings, and Decoding it. So I call it "c / s". ^ _ ^

At present, many codes are still in perfect. Brief introduction:

Aryfiles.push ("c: //aaa.zip"); AryFiles.push ("c: //bbb.exe"); here is file path and file. You can use this path after multiple times. Client takes place

http: // www.xxx.com/xxx/xxx.asp This is the destination, which can be changed to the address you want.

ADO_STREAM.LOADFROMFILE (Server.mappath (") Server.mappath (". ") &" / "& str_filename is here a read file .server.mappath (". ") & "/" & Path and storage path

ADO_STREAM.SAVETOFILE Server.mappath (".") & "/" & str_filename, 2 server.mappath (".") & "/" & this path to store files. Str_FileName is the file name

The read and storage here are placed in the program placed in the program. You can also keep this way when you test.

Put the first code to the local (EG: C: /upload.htm)

Putting the second code on the server, you can be a local server, which can be a public network server. He is consistent with the destination above (Eg: http://www.xxx.com/upload.asp or http: // localhost / www/upload.asp

Action: Find the place where the first code saved. OK (EG: Open the C drive to execute UPLOAD.HTM)

Client code