Scripting for file transfer

M

maxwelton

I have the following in a csh script. This is run on a remote system
and the
goal is to allow a user on a client to tar and gzip files and download
them to
their system. All I get is streamed data to the browser. Any help
would
be appreciated.



# ! /bin/csh

echo "Content-description: File Transfer'\n"
echo "'Content-type: application/x-gzip\n'"
echo "Content-disposition: attachment; filename=\"site.tar.gz\"\n";

# < do some file redirection in here ->

tar cf - * | gzip -c

#end

The interesting thing is if I do:

tar cf - * | gzip -c > site.tar.gz

then the file is able to be unzipped and untarred and it is all good.
I think my problem is somewhere in those 'content' headers. I can
also try :

tar zcf - * | cat

and this streams the data to the browser as well.
 
C

Chris F.A. Johnson

I have the following in a csh script. This is run on a remote system
and the goal is to allow a user on a client to tar and gzip files
and download them to their system. All I get is streamed data to the
browser. Any help would be appreciated.

This more properly belongs in a group devoted to CGI programming,
e.g., comp.infosystems.www.authoring.cgi.
# ! /bin/csh

I recommend that you do not write scripts in csh; read these for
more information:

<http://www.grymoire.com/Unix/CshTop10.txt>
<http://www.grymoire.com/Unix/Csh.html#uh-0>
echo "Content-description: File Transfer'\n"
echo "'Content-type: application/x-gzip\n'"
echo "Content-disposition: attachment; filename=\"site.tar.gz\"\n";

# < do some file redirection in here ->

tar cf - * | gzip -c

#end

You need a blank line after the headers:

echo "Content-disposition: attachment; filename=\"site.tar.gz\"\n\n";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top