Link to home
Start Free TrialLog in
Avatar of perlperl
perlperl

asked on

write mismatch

apache runs on host A  and all the cgi code is on host A
(cgi code uses <input type=file> to get the file

when i run executethe url from host B, i give th epath of the file c:\test\test.txt of host B.
the cgi creates a file out.txt, but cgi writes this file on the server A and not on my host B from where I am running.
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of perlperl
perlperl

ASKER

yes, i am new to cgi world....
Here is what I am looking.
I have host A, where Apache runs as web server......I have my website (all cgi scripts on host A)

now if the user hits the url http://www.hostname.com/cgi-bin/test.html  , the html  has browse button which asks user the filename.
test.html then gets redirected to http://www.hostname.com/cgi-bin/process.cgi   this creates a file called out.txt, problem it is saving the file in C: of host A.
I wwant to this file on the customers local desktop C:
What settings I need to do?
how can my cgi running on Host A can save a copy of file i create on customers local desktop.......
also, in test.html, user specifies the file c:\create.txt, but my cgi is looking for this file on host A C:\create.txt instead of using customers C:\create.txt

I am a bit confused
> I wwant to this file on the customers local desktop C:
your process.cgi has to return the file with a HTTP-header like
  Content-Type: data/unknow
which forces the browser to open the download dialog

Assuming your process.cgi is perl, then that part looks like:

  use CGI;
  my $q=new CGI;
  $text="here is your text from the file out.txt";
  print $q->header(-type=>"data");
  ptint $text;
  exit( 0 );