codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
FileName = request.QueryString("file")
path = request.QueryString("path")
strFileType = lcase(Right(FileName, 4))
' Feel Free to Add Your Own Content-Types Here
Select Case strFileType
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".asp"
ContentType = "text/asp"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename =" & filename
Set Stream = Server.CreateObject("ADODB.Stream")
Stream.Open
Stream.LoadFromFile Server.MapPath(path & Filename)
Conents = Stream.ReadText
Response.BinaryWrite Contents
Stream.Close
Set Stream = Nothing
%>
lo richiamo con
Sembra funzionare bene, salva il file nella dimensione giusta ma quando provo ad aprirlo mi da problemi
se provo con un'immagine non mi fa nemmeno l'anteprima..
il codice l'ho trovato con google e sembra funzionare, ma quando provo ad aprire il file mi da questo problema