Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Perl CGI to download files via web browser

by tanuj (Novice)
on Mar 08, 2013 at 13:35 UTC ( [id://1022418]=perlquestion: print w/replies, xml ) Need Help??

tanuj has asked for the wisdom of the Perl Monks concerning the following question:

Need some cgi-perl script which can download a file form server machine. EX: click on a download link and it will open a save as window and will allow me to same the file on my local machine. i have created a web page using CGI , using this i will upload a file to server and will run a perl script to convert it to some other format ( till here i am done) Now i need get this file back ( download back ) the the system.
  • Comment on Perl CGI to download files via web browser

Replies are listed 'Best First'.
Re: Perl CGI to download files via web browser
by marto (Cardinal) on Mar 08, 2013 at 13:47 UTC

    You mean the part you're stuck on is where you upload the file from a client machine back to the server? Your question could use some clarification, and you could show us the code you're actually working on/having problems with, How do I post a question effectively?.

      Thanks for the reply. there are three steps : 1. upload a file from my machine ( client ) to server machine using CGI -> i am done with this part. 2. convert the uploaded file to the required format -> i am done with this part too. 3. Now the converted file is under some dir of server machine , now i want to get ( downlaod ) this file back to may local machine ( client ) -> i am stuck in this part.

        One solution would be to load the file contents into memory and serve the content with the appropriate header. This of course depends on the size of the file, you don't want to load large files into memory and serve it like this. You could copy the file into a temporary web accessable area and provide a link to it.

        Other things to consider, do you want to remove the converted file after you've sered it, so that you don't end up filling some filesystem with old files people have downloaded? Perhaps you'd need to write a housekeeping script to tidy up these files/areas on a regular basis. Clarify your requirements and consider the implications of your system. See also Print to Browser Headers Not Working Serve a file from a CGI script.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-26 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found