Eccolo
Tieni conto che è in costruzione:
If Form.State = 0 Then 'Completted
Dim File, DestFileName
For Each File In Form.Files
If Len(File.FileName) > 0 Then
DestFileName = GetUniqueFileName(File.FileName, DestinationPath)
File.SaveAs DestinationPath & "\" & DestFileName
Response.Write "
<Font Color=green>File " & File.FileName & _
" was saved to " & DestinationPath & " as " & DestFileName & "</Font>"
End If
Next
response.redirect "Insert_null.asp"
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write "
<Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font>
"
case else response.write "
<Font Color=red>Some form error.</Font>
"
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)
Response.Write ("Il file..........") & NewFileName & ("...........è già presente sul'Hard Disk del server!L'OPERAZIONE E' STATA INTERROTTA!!")
exit function
end if
GetUniqueFileName = NewFileName
End Function