Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Getting CGI to name a file it returns

by Masem (Monsignor)
on Jul 16, 2001 at 20:53 UTC ( #97085=note: print w/replies, xml ) Need Help??

in reply to Getting CGI to name a file it returns

I believe you need to somehow present the URL to the browser of the generated page as:
Most servers (read: apache) don't try for the full path but instead descend level by level down the URL until they find something meanful (and grabbing .htaccess files along the way). When it reaches the level, it passes the remaining URL ("/myfile.txt?file=myfile.txt") info into a variable (I believe in $QUERY_STRING, but I can't verify this at the moment); will typically ignore the stuff until the '?', at which point it does it's own parsing. I'm about 99% sure meryln has a column on how to use virtual file structure information in a CGI statement.

On the browser side, most browsers look at the last 'filename' before the '?' as what the page should be saved as, so in the URL above, the browser would try to save this as myfile.txt. Note, however, this is a browser-dependant feature, though the 3 major ones (IE, NS, Opera) all do it this way.

So all you need to do is to make sure that the form that is used to generate this page has the appropriate extra file information in the FORM ACTION field.

Dr. Michael K. Neylon - || "You've left the lens cap of your mind on again, Pinky" - The Brain

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://97085]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-05-28 19:03 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (101 votes). Check out past polls.