File Manager
Back to List
| Current Directory: ~/
Editing: uploadTester_stu.asp.bak
Full path: C:\ict\ICT\uploadTester_stu.asp.bak
Permissions: rwx
Write test: File appears not directly writable
Current process identity: IIS APPPOOL\DefaultAppPool
<%@ Language=VBScript %> <% ''option explicit ''Response.Expires = -1 ''Server.ScriptTimeout = 2600 %> <!--#include file=freeASPUpload.asp--> <% ' **************************************************** ' Change the value of the variable below to the pathname ' of a directory with write permissions, for example "C:\Inetpub\wwwroot" Dim uploadsDirVar uploadsDirVar = Server.MapPath("pic_stu/") ' **************************************************** ' Note: this file uploadTester.asp is just an example to demonstrate ' the capabilities of the freeASPUpload.asp class. There are no plans ' to add any new features to uploadTester.asp itself. Feel free to add ' your own code. If you are building a content management system, you ' may also want to consider this script: http://www.webfilebrowser.com/ %> <% 'function TestEnvironment() ' Dim fso, fileName, testFile, streamTest ' TestEnvironment = "" ' Set fso = Server.CreateObject("Scripting.FileSystemObject") ' if not fso.FolderExists(uploadsDirVar) then ' TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and 'change the value of uploadsDirVar to the pathname of a directory with write permissions." ' exit function ' end if ' fileName = uploadsDirVar & "\test.txt" ' on error resume next ' Set testFile = fso.CreateTextFile(fileName, true) ' If Err.Number<>0 then ' TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions." ' exit function ' end if ' Err.Clear ' testFile.Close ' fso.DeleteFile(fileName) ' If Err.Number<>0 then ' TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder." ' exit function ' end if ' Err.Clear ' Set streamTest = Server.CreateObject("ADODB.Stream") ' If Err.Number<>0 then ' TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your 'ADODB libraries." ' exit function ' end if ' Set streamTest = Nothing 'end function function SaveFiles() Dim Upload, fileName, fileSize, ks, i, fileKey Set Upload = New FreeASPUpload Upload.Save(uploadsDirVar) If Err.Number<>0 then Exit function SaveFiles = "" ks = Upload.UploadedFiles.keys if (UBound(ks) <> -1) then for each fileKey in Upload.UploadedFiles.keys SaveFiles = Upload.UploadedFiles(fileKey).FileName next else SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system." end if end function %> <% dim savefile savefile=SaveFiles() response.write savefile session("savefile")=savefile '========================================����ش��� Upload================================= %> <!--#include file = "connectdb.asp"--> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> </head> <body> <% id_stu=session("id_stu") response.write "up.........."&savefile&" /"&id_stu sql_check="select * from student where id_stu='"&id_stu&"'" set ors_check=server.createobject("adodb.recordset") ors_check.open sql_check,conn,1,3 if not ors_check.eof then sqlupload="update student set pic_stu='"&savefile&"' where id_stu='"&id_stu&"'" set orsupload = Server.CreateObject("adodb.recordset") response.write sql_upload orsupload.open sqlupload,conn,1,3 response.write "aaa"&id_stu end if %> <meta http-equiv="refresh" content ="0;url=detail_stu.asp?id_stu=<%=id_stu%>"> </body> </html>