%
Option Explicit
'Stores only files with size less than MaxFileSize
Dim DestinationPath
DestinationPath = Server.mapPath("Uploads")
'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %>
<%
Server.ScriptTimeout = 2000
Form.SizeLimit = &HA00000
If Form.State = 0 Then 'Completted
Dim File, DestFileName
For Each File In Form.Files.Items
If Len(File.FileName) > 0 Then
DestFileName = GetUniqueFileName(File.FileName, DestinationPath)
File.SaveAs DestinationPath & "\" & DestFileName
End If
Next
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write "
Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)
"
case else response.write "
Some form error.
"
end Select
End If'Form.State = 0 then
Dim gFS
Function GetUniqueFileName(FileName, DestPath)
if isempty(gFS) then Set gFS = CreateObject("Scripting.FileSystemObject")
Dim Counter, FullPath, NewFileName
Counter = 1
NewFileName = FileName
if gFS.FileExists(DestPath & "\" & NewFileName) then
Do
Counter = Counter + 1
NewFileName = Counter & "-" & FileName
Loop while gFS.FileExists(DestPath & "\" & NewFileName)
end if
GetUniqueFileName = NewFileName
End Function
%>
|
|
|||||||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
|
THE BEST TALENTS.COM :: SITE MAP |
||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
| Feedback || Sitemap || Terms & Conditions || Disclaimer | |||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
| . |
© 2007 :: SR-I-Business Consultants |
||||||||||||||||||||||||||||||||||||||