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.
perlperlAsked:
Who is Participating?
 
TintinCommented:
Looks like you are a little unclear on CGI, HTTP and web server technologies.

<input type=file>

is not CGI code, it is HTML.

If your CGI program/script runs on host A, the only way it can write a file on Host B is by using what ever appropriate protocol you have setup between the two hosts.  This maybe ssh, ftp, NFS, SMB, HTTP or any number of other protocols.
0
 
perlperlAuthor Commented:
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?
0
 
perlperlAuthor Commented:
how can my cgi running on Host A can save a copy of file i create on customers local desktop.......
0
 
perlperlAuthor Commented:
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
0
 
ahoffmannCommented:
> 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 );
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.