ASP in the use of components or no component upload technology, can achieve file upload function. From this we can use ASP's no component upload technology, in our own site to build a virtual FTP server, like a real FTP server, for multiple users to provide remote file management, while each user can only operate their own files.
When the file upload, the ASP can use the FSO or database way to save the file data (some servers do not provide FSO function). Here I use the database to save the user uploaded files, the advantages of using the database I do not say, in short a lot. Another reason is that IIS limits the size of the file upload (probably the largest 200KB bar), using the database method can use the continuation of the technology to break through this limit, you can upload a large file, very large, infinite, ...
(Haha, a lot of nonsense, the following talk about the implementation of the method)
The first step: Create a database on the server (access, Sql-server, MySQL can be), easy to access it. Two tables are created in the database:
Upload user admin: admin (ID, Name, Password, Type)
Save uploaded file data: Files (ID, ParentID, FileName, Filelength, FileType, Filedata, UpDate, UserID).
If filelength=0, it is a folder, and a root folder is established for each user.
Step Two: Create a user login page, and use session to save the user's ID to restrict its operation to the file.
Session ("Name") = List ("Sname")
Session ("UID") = List ("ID")
Step three: Create the user's homepage (display the file that the user uploaded)
strSQL = "SELECT * from Files WHERE parentid=" & Userrootiduserrootid is the ID of the user's root folder
strSQL = strSQL & "and Userid=" & Session ("UID")
strSQL = strSQL & "ORDER by FileName"
Fourth step: Upload File page
List. AddNew
List ("ParentID") = Userrootid
List ("FileName") = Form ("Name")
List ("filelength") = Form ("Length")
List ("FileType") = Form ("Type")
List ("Filedata"). AppendChunk MidB (Sdata,form ("Start"), Form ("Length")
List ("UserID") = Session ("UID")
List ("UpDate") = Now ()
List. Update
Step Fifth: File management operations (use the ID of the file to identify the file and restrict the user's actions)