ASP Smart Upload - Fil størrelse og navn?
Hej EXP'er :PJeg bruger ASP smart upload, til at uploade billeder til min nystartet hjemmeside. Men der er bare INGEN begrænsninger på. Jeg vil gerne ha at mine brugere KUN kan uploade billeder der fylder omkring 300 kb og at billederne de upload kun må være JPG format! Nogen der evt. kan hjælpe?
<HTML>
<BODY BGCOLOR="white">
<!-- #include file = "meny.asp" -->
<H1> </H1>
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim oConn
Dim oRs
Dim intCount
intCount=0
Session.LCID = 1030
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' ******
intCount = mySmartUpload.Save("D:\WWW\Sykonia\logind\portal\billeder\")
' Connect to the DB
' 22:33 22-10-2004
Set oConn = Server.CreateObject("ADODB.Connection")
curDir = Server.MapPath("Er vidst ligemeget!")
oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};"
' Open a recordset
' ****************
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Add the current file in a DB field
' **********************************
Upload.SetMaxSize 30, True
file.SaveAs "c:\123\" & file.FileName
filnavn = "http://portal.sykonia.dk/billeder/" & file.FileName
SQL = "UPDATE anv SET bild = '" & filnavn & "' WHERE ID = '" & Session("id") & "'"
oConn.Execute (SQL)
intCount = intCount + 1
End If
Next
' Display the number of files uploaded
' ************************************
response.Redirect "visprofil.asp"
' Destruction
' ***********
oConn.Close
Set oConn = Nothing
%>
</BODY>
</HTML>
