<% response.buffer=true Server.ScriptTimeout = 99999999 %> <% Response.Expires=0 Response.Buffer = TRUE Response.Clear byteCount = Request.TotalBytes ' tamanhomaximo de 0,5 MB 'If byteCount > 20480 Then ' Response.Write "
Não deu certo... tamanho da Imagem é maior que 200kb
voltar Seu Tamanho é de:
" & byteCount ' Response.End ' End If 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") vname_img = UploadRequest.Item("name_img").Item("Value") filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) filename = Replace(filename,".", "_" & rndit &".") value = UploadRequest.Item("blob").Item("Value") 'obtem o diretorio fisico de onde se encontra o site para realizacao do upload do arquivo FUNCTION SiteFisico() strFullPath = Request.ServerVariables("PATH_TRANSLATED") DO UNTIL strLastChar = "\" strLastChar = RIGHT(strFullPath, 1) strFullPath = LEFT(strFullPath, LEN(strFullPath) - 1) LOOP 'identifica diretorios: fisico e virtual do site SiteFisico = strFullPath END FUNCTION Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject") pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14 Set MyFile = ScriptObject.CreateTextFile( Server.mappath("../../images_foto/"&filename)) For i = 1 to LenB(value) MyFile.Write chr(AscB(MidB(value,i,1))) Next MyFile.Close 'renomeia ao arquivo Function rndit() Dim RndTemp Randomize RndTemp = Rnd * 10000 RndTemp= Int(RndTemp) rndit = RndTemp End Function PasswordTemp = rndit() codigo = PasswordTemp 'response.write vcounter ' Create instance of AspJpeg Set Jpeg = Server.CreateObject("Persits.Jpeg") ' Foto Grande ######################################### Jpeg.Open Server.mappath("../../images_foto/"&filename) ' New width L = 250 h = 166 ' Resize, preserve aspect ratio Jpeg.Width = L Jpeg.Height = h 'Jpeg.OriginalHeight * L / Jpeg.OriginalWidth vfilepequeno = filename ' create thumbnail and save it to disk Jpeg.Save Server.mappath("../../images_foto/" & vfilepequeno) ' Create instance of AspJpeg Set Jpeg = Server.CreateObject("Persits.Jpeg") ' Foto PEquena ######################################### Jpeg.Open Server.mappath("../../images_foto/"&filename) ' New width L = 75 h = 50 ' Resize, preserve aspect ratio Jpeg.Width = L Jpeg.Height = h 'Jpeg.OriginalHeight * L / Jpeg.OriginalWidth vfilepequeno = Replace(filename,".", "_Peq.") ' create thumbnail and save it to disk Jpeg.Save Server.mappath("../../images_foto/" & vfilepequeno) %>