We don't use witango anymore, but at the time, we had to do this, and
experimented with many different ways due to issues with certain browser
issues.

I think later, we found that the best way to do this was to store the
length in the DB, or use mysql to calculate the length of the binary if
it was a blob. We had found that using @length or varinfo could
sometimes be a single byte off and cause a serious problem on I think
IE. But if it isn't needed now, that is great, but we only added it in
after dealing with specific issues. Keep in mind, eventpix served
MILLIONS of images a day.

On 3/29/2011 11:41 AM, Robert Shubert wrote:
> Just to touch on the Content-Length item.
>
> Some web servers will add it if you leave it out, so you can try letting the 
> web server calculate and add the Content-Length (the same is true for the 
> Date header).
>
> Also, @LENGTH should not be used to find the length of a single variable, 
> especially one with binary data in it. Instead use @VARINFO like this:
>
> <@VARINFO scope$varName size>
>
> This will return much faster and should be accurate for binary data.
>
> Robert
>
> -----Original Message-----
> From: Robert Garcia [mailto:[email protected]]
> Sent: Tuesday, March 29, 2011 2:28 PM
> To: [email protected]
> Cc: Robert Shubert
> Subject: Re: Witango-Talk: Forcing jpg Download
>
> We have done that many times before in witango. That is the correct
> header you need to use, and attachment is the correct way. However, it
> looks like you are trying to put the contents of the file in the
> filename part, that header just takes the filename, and it should end in
> JPG or JPEG, or match the mime of the content with the extension, or it
> may not work on all browsers. Then you dump out the contents of the jpeg
> AFTER the header. Here is an example I found from a TAF that I know we
> had working:
>
> <@assign name="httpHeader" scope="request" value="HTTP/1.0 200
> OK<@crlf>MIME-Version: 1.0<@crlf>Content-type:
> application/download<@crlf>Content-Disposition: attachment;
> filename=downloadreport.xls<@crlf>Content-Length:<@length
> @@request$FileData><@crlf><@crlf>"><@purgeresults><@VAR Request$FileData>
>
> It is important to know that you must NOT have ANY returns in this
> results page where you use this code, it should be on one line. We do
> this in other places with JPEGs, but we use image/jpeg for content-type,
> and a variable usually for filename. Content-length is also important,
> but can be a big buggy in witango.
>
> On 3/29/2011 11:09 AM, Robert Shubert wrote:
>> In that case, I think you have the header correct. What you need to do 
>> afterwards is use a Read File Action to bring the content of the JPEG into 
>> Witango and then simply display it as the response. It's important that you 
>> don't get any additional characters (like extra returns or spaces in the 
>> result)
>>
>> Robert
>>
>> -----Original Message-----
>> From: WebDude [mailto:[email protected]]
>> Sent: Tuesday, March 29, 2011 1:49 PM
>> To: [email protected]
>> Subject: RE: Witango-Talk: Forcing jpg Download
>>
>> <@COLUMN "images.LargerImage">   is the name of the file.
>>
>>
>>
>>
>> -----Original Message-----
>> From: Robert Shubert [mailto:[email protected]]
>> Sent: Tuesday, March 29, 2011 12:06 PM
>> To: [email protected]
>> Subject: RE: Witango-Talk: Forcing jpg Download
>>
>> What is in the database column<@COLUMN "images.LargerImage">? Is this the
>> name of the image file or the binary JPEG data?
>>
>> Robert
>>
>> -----Original Message-----
>> From: WebDude [mailto:[email protected]]
>> Sent: Tuesday, March 29, 2011 12:45 PM
>> To: [email protected]
>> Subject: Witango-Talk: Forcing jpg Download
>>
>> PHP has a handy header rewrite for forcing a jpg download. I was wondering
>> if anyone has ever done this in Witango. I've been able to get this to work
>> on IIS by changing the directory header, the problem being is that I have 2
>> sites that reference the same images and one needs to force a download and
>> the other to view the image in a browser (same images in the same
>> directories).
>>
>> I've been dabbling but can't seem to get it to work right. Of course when I
>> add header change to the top of the taf file, it tries to download the taf
>> file itself rather then the jpg file. This is stupid I know, but what is the
>> best way to force a download of a jpg and get it to work? This is what I
>> have so far. Am I missing something fundamental in trying to do this?
>>
>> <@purgeresults><@ASSIGN local$httpHeader
>> VALUE="Content-Type:application/jpg<@CRLF>Content-Disposition: attachment,
>> filename='<@COLUMN "images.LargerImage">'<@CRLF>readfile('<@COLUMN
>> "images.LargerImage">')<@CRLF><@USERREFERENCECOOKIE><@CRLF>">
>>
>> Thanks for your thoughts...
>>
>>
>>
>> WebDude
>>
>>
>>
>>
>> ----------------------------------------
>>
>> To unsubscribe from this list, please send an email to [email protected]
>> with "unsubscribe witango-talk" in the body.
>>
>>
>>
>> ----------------------------------------
>>
>> To unsubscribe from this list, please send an email to [email protected]
>> with "unsubscribe witango-talk" in the body.
>>
>>
>>
>> ----------------------------------------
>>
>> To unsubscribe from this list, please send an email to [email protected] 
>> with "unsubscribe witango-talk" in the body.
>>
>>
>>
>> ----------------------------------------
>>
>> To unsubscribe from this list, please send an email to [email protected] 
>> with "unsubscribe witango-talk" in the body.
>>

--
Robert Garcia
BigHead Technology
15520 Coutelenc Rd
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[email protected] - http://bighead.net/




----------------------------------------

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe witango-talk" in the body.

Reply via email to