[Webinar] Streamline your web hosting managementRegister Today



Posted on 2006-04-21
Medium Priority
Last Modified: 2013-12-25
well, i am completely confused and moving in circles
let me explain what i am looking

i ahve website runnin on apache home page is test.html

1) test.html has <input type=file> on submit redirects to testicgi
2) test.cgi reads the filename. it is .doc format, performs some operation and create a .xls file.......
3) i want to save the file back to clients machine

problem is in step 2) test.cgi looks for the .doc on server instead of clients machine......i don't know why
Question by:perlperl

Accepted Solution

whatbox earned 672 total points
ID: 16511197
The CGI is a server side program... meaning it runs on the server itself. It does not have direct access to any files stored on the local machine.   Your test.cgi needs to save the file to the server drive first if you want to access it as filename.doc, or if the cgi itself is just performing a conversion the xls format it simply needs to save it as .xls once it is done.  I assume that once complete the user probably would want to download the converted file, so you would provide a link to the new file on the server.    
LVL 85

Assisted Solution

ozo earned 664 total points
ID: 16512228
print "Content-Type: application/octet-stream\r\nContent-Disposition: attachment; filename=filename.xls\r\n\r\n";  #the browser is free to ignore filename
print <FILE>;

Author Comment

ID: 16525038
1) How can I copy the .doc file from client to server box
2) How can I copy the file back to client's box
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Author Comment

ID: 16525090
1) How can I copy the .doc file from client to server box
2) How can I copy the .xls file from client to server box
2) How can I copy the file .xls back to client's box
LVL 20

Assisted Solution

Gawai earned 664 total points
ID: 16614465
u cant use the client resource. u can just allow user to browse the file and upload to ur server. but by cgi coding u cant copy client file to server without user act. user has to upload the .doc file by their wish.
LVL 20

Expert Comment

ID: 16614480
again u cant save back any file to client machine unless clients hits download button or download link.. hope its clear to u

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question