Ciao a tutti; ho questo semplice codice per l'upload di files su un server che mi controlla anche che il peso dell'img da caricare non sia superiore ad un certo limite.
Voglio chiedervi se è possibile prevedere anche un controllo sulle dimensioni dell'immagine da caricare, ho provato così ma non funziona:
Codice completo:codice:If .filename("Height")>=200 or filename("Width")>=200 then Response.write ("Le dimensioni dell'immagine non sono corrette (" &_ filename("Height") &"x" & filename("Width") &"): File non caricato " ) else Response.Write "Immagine Salvata " end if
codice:<% Response.Expires=0 Response.Buffer = TRUE Response.Clear byteCount = Request.TotalBytes RequestBin = Request.BinaryRead(byteCount) Dim UploadRequest Set UploadRequest = CreateObject("Scripting.Dictionary") BuildUploadRequest RequestBin contentType = UploadRequest.Item("blob").Item("ContentType") filepathname = UploadRequest.Item("blob").Item("FileName") filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) value = UploadRequest.Item("blob").Item("Value") If cLng(byteCount)>(10000) then Response.write ("L'immagine è troppo grande") else Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject") pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14 Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & filename) For i = 1 to LenB(value) MyFile.Write chr(AscB(MidB(value,i,1))) Next MyFile.Close response.write "OK" end if %>

Rispondi quotando