Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: cgi question - using an image button for filefield

by simon.proctor (Vicar)
on Nov 12, 2004 at 15:50 UTC ( [id://407389]=note: print w/replies, xml ) Need Help??


in reply to cgi question - using an image button for filefield

To do this go here: Quirks mode css site

As you will see - its hardly elegant but if that is what you want :).
  • Comment on Re: cgi question - using an image button for filefield

Replies are listed 'Best First'.
Re^2: cgi question - using an image button for filefield
by Anonymous Monk on Nov 12, 2004 at 16:21 UTC
    Doesn't look elegant at all, is there no other way to do this kind of thing?
    Thanks,
    Jonathan
      Hi Jonathan,

      How about something like this, uses a bit of scripting instead of all that css stuff:
      #!/usr/bin/perl -w use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); #errors will show in the browser my $co=new CGI; print $co->header, $co->start_html( -title=>'fileupload.cgi', -BGCOLOR=>'#FFFFFF', ), $co->start_form( -method=>'POST', -name=>"myForm", -action=> "http://localhost/cgi-bin/fileupload2.cgi", ), $co-> filefield( -name => 'browse', -style => 'display:none' ), $co-> textfield( -name => 'file', ), "&nbsp;&nbsp;&nbsp;&nbsp;", "<a href=\"#\" onClick=\"document.forms[0].browse.click();document.for +ms[0].file.value=document.forms[0].browse.value;return false;\">", "<img name=\"browse\" src=\"http://localhost/html/browse.bmp\" alt=\"b +rowse\" border=\"0\"></a>", $co->p, $co->image_button( -name => 'submit', -src => 'http://localhost/html/add.bmp', -value => "Submit", -onclick => "document.forms[0].browse.disabled=tru +e;document.forms[0].submit()", ), $co->end_form(), $co->end_html; exit 0;
      I've tried this myself and it does appear to work.
      Enjoy,
      Martymart

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-19 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found