Avatar of Michael Ambech
Michael Ambech
 asked on

Excluding file types and limiting filesize in classic asp upload script

Hi all,

I have a fileupload function which works fine. Consists of a page for selection of the file and a page for upload. Now I want to limit the filetypes and also the size of the files that are being uploaded. I guess the latter is a question of removing ' from oFileUp.Maxbytes = 300? But doing so has no effect - files are uploaded even if I set it to 0 AND remove the '. The Code for upload is below, suggestions much appreciated!

<%
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
oFileUp.Path = "path to file on server..."
'oFileUp.CreateNewFile = True
oFileUp.OverWriteFiles = True
'oFileUp.Maxbytes = 300
If Not oFileUp.Form("file1").IsEmpty Then
oFileUp.Form("file1").Save
strFileName = oFileUp.ShortFileName
filnavn = strFilename
If Err.Number <> 0 Then
Response.Write "<B>Error description:</B> " & Err.Description
Else
Response.Write "<h4><center><br><b>Your " & filnavn & " was recieved.<b></center>"
End If
Else
Response.Write "Error! No file designated for upload!"
End If
Set oFileUp = Nothing


%>

Open in new window

ASP

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61