03. marts 2004 - 12:04Der er
5 kommentarer og 1 løsning
Sætte max størrelse og gyldige fil typer i AspSmartUpload
Hej
jeg har denne kode som jeg oploader billeder med til min server:
' Variables ' ********* Dim mySmartUpload Dim intCount
' Object creation ' *************** Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload ' ****** mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server ' **************************************************************************** intCount = mySmartUpload.Save("/img/images/" & dato) ' sample with a physical path ' intCount = mySmartUpload.Save("c:\temp\")
' Display the number of files uploaded ' ************************************ Response.Write(intCount & " file(s) billeder er oploadet til serveren.")
er der nolge der kna kam hjælpe mig med at lave noget kode som viser en fejl vis nolge eller en af filerne er større en 50 kb og vis fil typen ikke er af typen JPG, GIF, BMP
//Only allow jpg,gif,bmp files mySmartUpload.AllowedFilesList = "jpg,gif,bmp"; //DeniedFilesList can also be used : //Allow all files except exe, bat and asp //mySmartUpload.DeniedFilesList = "exe,bat,asp"
//Only allow files smaller than 50KB mySmartUpload.MaxFileSize = 51200;
//Only allow jpg,gif,bmp files mySmartUpload.AllowedFilesList = "jpg,gif,bmp" //DeniedFilesList can also be used : //Allow all files except exe, bat and asp //mySmartUpload.DeniedFilesList = "exe,bat,asp"
//Only allow files smaller than 50KB mySmartUpload.MaxFileSize = 51200
'Only allow jpg,gif,bmp files mySmartUpload.AllowedFilesList = "jpg,gif,bmp" 'DeniedFilesList can also be used : 'Allow all files except exe, bat and asp 'mySmartUpload.DeniedFilesList = "exe,bat,asp"
'Only allow files smaller than 50KB mySmartUpload.MaxFileSize = 51200
' Object creation Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Only allow jpg,gif,bmp files mySmartUpload.AllowedFilesList = "jpg,gif,bmp" ' DeniedFilesList can also be used : ' Allow all files except exe, bat and asp ' mySmartUpload.DeniedFilesList = "exe,bat,asp"
'Only allow files smaller than 50KB mySmartUpload.MaxFileSize = 51200
' Upload mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server intCount = mySmartUpload.Save("/img/images/" & dato)
' Trap errors If Err Then Response.Write("<b>Wrong selection: </b>" & Err.description) End If
' Display the number of files uploaded Response.Write(intCount & " file(s) billeder er oploadet til serveren.")
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.