---Sherlock, Ric wrote: > I've been trying to work out how to use JHP to download files. ... > I want to force the prompt and for it to be a name that I choose. > > To do that I think I need the Content-disposition Response > header. Is this just a question of adding a ContentDisp verb > to jhp.ijs analagous to ContentType? Or is there more involved?
I added the verb ContentDisp (at bottom) and can now get it a prompt to save the file with the desired file name. However it took me a while to work out how to specify ContentType, ContentDisp and Expires all together. I think I'm right in saying that in the response stream, everything before the first occurrence of two LFs is interpreted by the server as the response headers. The definition of ContentType ends with two LFs and so must be the last response header specified. It would be good to clarify this on the JHP syntax page, which at the moment says "It is required that that the first line of the page specifies the MIME format" and is now therefore a bit misleading. The following work: Expires 0 ContentDisp <myfile.ext> ContentType <mimetype> Or ContentType <mimetype> [ ContentDisp <myfile.ext> [ Expires 0 ContentDisp=: 3 : 0 if. 0 <: nc<'ContentDispSet_j_' do. return. end. ContentDispSet_j_=: y println 'Content-Disposition: attachment; filename=',y ) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
