|
YouUpload -- File Upload Component |
|
Welcome to YouUpload! |
See license.txt.
Supports uploading multiple files
All formats of file upload, zip, JPG, and GIF are supported.
Supports renaming and saving uploaded files
Other form inputs can be used to carry additional information, for example, file description.
Supports determining the size and type of uploaded files
Supports SAVING file content to the database
Supports uploading to the FTP directory
You do not need to set the directory to write in IIS (if it is an NTFS file system, its security needs to be set, you can simply set it to everyone full control, or set it to iusr_server full control)
Youupload is free of charge and has no function restrictions.
Applicable to Windows 98 + pws4, NT4.0 SERVER + IIS 4, Win2k + IIS 5
Http://www.csdn.net
Requirements: Windows NT Server 4 edition + SP3 + ie4.01 + Option Pack/WIN98 + ie4.01
1. If you download the installer, run Setup.
2. Test. Copy examples in the installation directory to the release directory of the Web server to test the default document default. asp.
3. Enter 'HTTP: // yourhost/uploadtest/'in the address bar of the browser /'
4. If there is copyright ownership on the top of the page, it will be okay.
5. upload some files and try again.
- Object. Form (FieldName)
Return form data
Object. Form ("title") 'title is the Form name
-
Object. SaveFile (FieldName, FileName)
FieldName: form name
FileName: New File Name (Note: path should be included)
Dim upl, FileName
Set upl = Server. CreateObject ("yousoft. YouUpload ")
FileName = upl. FileName ("File1 ")
Upl. SaveFile "File1", "c:/temp/" & FileName
-
Object. savefileas (fieldname, fname)
Fieldname: form name
Filename: New File Name (Note: path should be included)
Dim UPL, filename
Set upl = server. Createobject ("yousoft. youupload ")
Filename = upl. filename ("file1 ")
Upl. savefileas "file1", "C:/temp/" & filename
-
Object. savetoftp (ftp_host, ftp_port, timeout, ftp_user, ftp_password,
Use_proxy, proxy_host, proxy_port, user_dir, fieldname, filename)
Ftp_host: ftp host (preferably IP address)
Ftp_port: FTP server port (usually 21)
Timeout: FTP connection timeout
Ftp_user: FTP login name
Ftp_password: ftp logon Password
Use_proxy: whether to use a proxy server to connect to FTP. If it is set to 1, use proxy = 0 instead of proxy.
Proxy_host: proxy server host (preferably IP), used in combination with use_proxy
Proxy_port: proxy server port, used in combination with use_proxy
User_dir: Specifies the current FTP path. If it is null, no path is specified, that is, the default path after logon.
Fieldname: form name, from which to save the file
FileName: Specifies the new file name.
Obj. SaveToFtp "192.168.7.168", 21,5000, "xu", "xu", 0, "", 0, "", "file1", "new.exe"
-
Object. FileName (FieldName)
-
Get the file name (including the extension)
-
Object. FilePath (FieldName)
Obtain the path of the uploaded file
-
Object. FileSize (FieldName)
Get the size of the uploaded file
-
Object. FileExt (FieldName)
Get the Upload File Extension
-
Object. OldFileName (FieldName)
Obtain the complete name of the uploaded file (including the path)
-
Object. FileNameX (FieldName)
Get the file name (excluding the extension)
-
Object. Count
Number of uploaded files
-
Object. TotalBytes
Total Bytes of uploaded data
-
Object. SpendTime
Upload time (unit: milliseconds)
-
Object. userFile (N)
Obtain the nth name (form name) of the uploaded file)
-
Object. GetFileData (FieldName, DataType)
Obtain uploaded file data
DataType:
"Bin" retrieves binary data
"Txt" to retrieve text data
You can obtain data and store it in the database in text or binary format.
<% = Obj. GetFileData ("File1", "txt") %>
-
Object. Version
Obtain the current YouUpload version
|
See examples in the examples directory
Writing form upload <Form enctype = "multipart/form-Data" method = "Post" Action = "Upload. asp" name = "Upload">
Enctype = "multipart/form-Data" is required, and the method must be post
If you obtain the number of files uploaded Set OBJ = server. Createobject ("yousoft. uploadfile ")
Response. Write "file count:" & obj. Count
If multiple files are uploaded OBJ. userfile (N)
Obtain the nth name (form name) of the uploaded file)
How to get the file suffix EXT = fileext (fieldname) 'fieldname is the form name, for example, 'file1'
How to save the file content to the database
If you use SQL Server, You need to define an image field
Dim Conn, RS
Set conn = server. Createobject ("ADODB. Connection ")
Conn. Open "testfile", "sa", "XXX"
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open "select * From where filename is null", Conn, 1, 3
Rs. addnew
RS ("FILENAME") = obj. filename ('file1 ')
RS ("filesize") = obj. filesize ('file1 ')
RS ("filecontent"). AppendChunk obj. getfiledata (userfile, "bin") 'blob data cannot be directly assigned values. If it is not binary, save "bin" to "TXT"
Rs. Update
Rs. Close
Conn. Close
Set rs = nothing
Set conn = nothing
On the contrary, to extract data from the database, please refer to the following program
Dim Conn, RS
Dim content
Set conn = server. CreateObject ("adodb. connection ")
Conn. open "testfile", "sa", "xxx"
Set rs = server. CreateObject ("adodb. recordset ")
Rs. Open "SELECT * FROM where id =" & id, conn, 1, 1
Content = rs ("filecontent"). getChunk (clng (rs ("filesize ")))))
Conn. Close
Set rs = nothing
Set conn = nothing
Possible Installation Problems
If you find out, please contact me!
Problems with program usage
If you find out, please contact me!
If you find any problem in the test, please mailto: yousoft@chinaren.com? Subject = about YouUpload, or please discuss or leave a message on the bbs on my homepage.
I hope you will have more comments on this component.
When we discuss asp, we often encounter many problems that can only be solved by using asp components, and these com can only be found on foreign sites, it can be seen that there are still few such aspects in China. So I hope you can get your support.
|