This script use to but now it does not

Results 1 to 2 of 2

Thread: This script use to but now it does not

  1. #1
    Join Date
    Dec 1969

    Default This script use to but now it does not

    I&#039;m a photographer and I have a site where I expose my pictures for people to look at. I use a script to stop people from linking directly to my pictures up to not to long ago the system was working perfect but now for some raison I have no idea why it stoped.<BR><BR>I try under Linux with Mozilla and konqueror and it works great but with IE I have some javascript error or broken pictures if you could help I will realy be gratfull.<BR><BR>---- Script ----<BR>&#060;% Option Explicit %&#062;<BR>&#060;% Response.Buffer=True %&#062;<BR>&#060;%<BR>Public fso, objFile, fileName<BR>Public objStream, fileSize<BR>If Session("load-story") = "" Then<BR>fileName = "D:webfarmxyzabcCIAImages.comhelloworldGalleryad. gif"<BR>else<BR>fileName = "D:webfarmxyzabcCIAImages.comhelloworldGallery\"&R equest("image")<BR>end if<BR> &#039;need to get image size in bytes...<BR> Set fso = Server.CreateObject("Scripting.FileSystemObject")< BR> Set objFile = fso.GetFile(fileName)<BR> fileSize = objFile.Size<BR> Set objFile = Nothing<BR> Set fso = Nothing<BR> Set objStream = Server.CreateObject("ADODB.Stream")<BR> objStream.Open<BR> objStream.Type = 1 &#039;adTypeBinary<BR> objStream.LoadFromFile fileName<BR> Response.AddHeader "Content-Disposition", "attachment; filename="&ExtractName(fileName)<BR> Response.AddHeader "Content-Length", fileSize<BR> Response.Charset = "UTF-8"<BR> Response.ContentType = "Image/Jpeg"<BR> Response.BinaryWrite objStream.Read(fileSize)<BR> Response.Flush<BR> objStream.Close<BR> Set objStream = Nothing<BR><BR> Function ExtractName(str)<BR> Dim arrTmp<BR> arrTmp = Split(str, "\")<BR> ExtractName = arrTmp(UBound(arrTmp))<BR> End Function<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default It looks right to me...

    You don&#039;t need the Response.Charset, because there won&#039;t *be* any characters sent, so it is irrelevant.<BR><BR>I don&#039;t understand why MSIE would give you a JavaScript error from this. JavaScript isn&#039;t involved in loading the picture, from what you show here.<BR><BR>Can you copy/paste the error you get, when you get it?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts