Re: how to send a page and a file at a download script?
On Monday 22 September 2008 12:38:21 pm shnaxe wrote: > dear readers, > > i recently finished a small perl-cgi download script that sends files > after some checks and logging. i call this script through a link on a > static html-page and pass the file-id as a parameter. > > this all works nice so far, the part where i'm stuck at is that with > clicking on the link, the page containig the link is replaced by a > white blank page. i wonder how i could instead get either: > - the page containig the link stays, link is targeted to a new window > (minimal version) > - a new page is displayed containg something like 'thank you for > downloading... you download should start now...' (deluxe solution) > > for the minimal version, i thought putting a simple 'target="_blank"' > into the link should do what i want (only tested with firefox 3.0 so > far). this indeed works, but the focus changes to the popping up new > blank tab and further, this tab stays open after the file is > transferred. i remember having seen this differently on the web. > > for the deluxe verson i think i somehow need to send out two headers, > one of type 'application/x-download' (for the file) and another of > type 'text/html' (for the page). > but how would i do this? i'm afraid that the second header (whichever) > will not get recognized as a second document but be embedded into the > first. i guess a short sleep between the first and the second header > won't do it... > > thanks for help and suggestions in advance, > regards, shnaxe > > ps: well, i am unsure if this would have been better posted to another > group (but which) since its maybe not a pure perl-question. i got to > admit that from my point of knowledge, the solution to the problem i > described seems to be somewhere on a blurry line between perl/cgi and > html... you could use Java Script , the history function , in your Perl script do something like this assuming your using CGI.pm , if not you should. use CGI; my q = new CGI; print $q->header(),$q->start_html; print ''."\n"; print 'history.go(-1);'. "\n"; print ''. "\n"; print $q->end_html; this will force the browser to go to the page that launched the called Perl script. hope this helps some. just one of many ways of doing the same thing Greg -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi and ssh
Dermot Paikkos wrote: > Hi, > > I have a cgi script that needs scp a file from one server to another. > Because the script runs under the httpd user With suEXEC you can run that script (and only that script) under an account you create with otherwise very limited privileges. http://httpd.apache.org/docs/1.3/suexec.html -- David Dorward http://dorward.me.uk/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
cgi and ssh
Hi, I have a cgi script that needs scp a file from one server to another. Because the script runs under the httpd user, for this to work without prompting for password, I need to do a lot of configuring that I am not sure would be consider good practise. For example: the httpd user's account this currently set as 'noloign' that would need to change to bash or similar. I have to generate ssh key without a password. In the past I have used nfs for copying files from one server to another but this isn't an option. Can anyone advise me about this? Will enabling the httpd user be a security issue? Is there a safer alternative? TIA, Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how to send a page and a file at a download script?
shnaxe wrote: > dear readers, > > i recently finished a small perl-cgi download script that sends files > after some checks and logging. i call this script through a link on a > static html-page and pass the file-id as a parameter. > > this all works nice so far, the part where i'm stuck at is that with > clicking on the link, the page containig the link is replaced by a > white blank page. i wonder how i could instead get either: > - the page containig the link stays, link is targeted to a new window > (minimal version) > - a new page is displayed containg something like 'thank you for > downloading... you download should start now...' (deluxe solution) > > for the minimal version, i thought putting a simple 'target="_blank"' > into the link should do what i want (only tested with firefox 3.0 so > far). this indeed works, but the focus changes to the popping up new > blank tab and further, this tab stays open after the file is > transferred. i remember having seen this differently on the web. > > for the deluxe verson i think i somehow need to send out two headers, > one of type 'application/x-download' (for the file) and another of > type 'text/html' (for the page). > but how would i do this? i'm afraid that the second header (whichever) > will not get recognized as a second document but be embedded into the > first. i guess a short sleep between the first and the second header > won't do it... > You shouldn't really need a new window at all if you don't want one, at least not in some browsers. If you return the proper headers followed by the content then the user should be able to click the download link and stay right where they are with the standard browser action occuring. If you return a proper content-type then the browser should just do what you want, if you return a Content-Disposition header then you will get to specify a suggested filename, etc. 'application/octet-stream' can usually be used as a generic download header if you don't have a specific content-type in mind. So your headers might be: Content-Type: application/octet-stream Content-Disposition: attachment; filename=some download.pdf or in the above case if you know it will be a PDF, Content-type: application/pdf > thanks for help and suggestions in advance, > regards, shnaxe HTH, http://danconia.org > > ps: well, i am unsure if this would have been better posted to another > group (but which) since its maybe not a pure perl-question. i got to > admit that from my point of knowledge, the solution to the problem i > described seems to be somewhere on a blurry line between perl/cgi and > html... > > I'd say it is appropriate. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
how to send a page and a file at a download script?
dear readers, i recently finished a small perl-cgi download script that sends files after some checks and logging. i call this script through a link on a static html-page and pass the file-id as a parameter. this all works nice so far, the part where i'm stuck at is that with clicking on the link, the page containig the link is replaced by a white blank page. i wonder how i could instead get either: - the page containig the link stays, link is targeted to a new window (minimal version) - a new page is displayed containg something like 'thank you for downloading... you download should start now...' (deluxe solution) for the minimal version, i thought putting a simple 'target="_blank"' into the link should do what i want (only tested with firefox 3.0 so far). this indeed works, but the focus changes to the popping up new blank tab and further, this tab stays open after the file is transferred. i remember having seen this differently on the web. for the deluxe verson i think i somehow need to send out two headers, one of type 'application/x-download' (for the file) and another of type 'text/html' (for the page). but how would i do this? i'm afraid that the second header (whichever) will not get recognized as a second document but be embedded into the first. i guess a short sleep between the first and the second header won't do it... thanks for help and suggestions in advance, regards, shnaxe ps: well, i am unsure if this would have been better posted to another group (but which) since its maybe not a pure perl-question. i got to admit that from my point of knowledge, the solution to the problem i described seems to be somewhere on a blurry line between perl/cgi and html... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/