PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > send file from CGI
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
send file from CGI

Réponse
 
LinkBack Outils de la discussion
Vieux 04/11/2007, 17h28   #1
detlef.reichl@gmx.org
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut send file from CGI

Hi,

in a webapplication, a user can select from some options. Depending on
the selection some files are packed together in a zip file and get send
to the user. So far it works perfect, but the zip file is not recognized
from the browser and it displays the data as garbage.

The code that sends the data:


print @cgi.header("type" => "application/zip")
print @cgi.header("length" => File.size(zipfile).to_s)

file = File.new(zipfile, "r" )
while true
begin
data = file.sysread(65536)
rescue EOFError
break
else
@cgi.print data
end
end



Any suggestions?

Cheers
detlef


  Réponse avec citation
Vieux 04/11/2007, 17h34   #2
dv@voelkerts.de
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send file from CGI

Detlef Reichl schrieb:

Hi Detlef,
> Any suggestions?
>
>

Wouldn't be easier to redirect the clients browser to the zip file? In
addition is "application/zip" the correct mime type?

HTH,

Daniel

  Réponse avec citation
Vieux 04/11/2007, 17h40   #3
detlef.reichl@gmx.org
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send file from CGI

Am Montag, den 05.11.2007, 01:34 +0900 schrieb Daniel Völkerts:
> Detlef Reichl schrieb:
>
> Hi Detlef,
> > Any suggestions?
> >
> >

> Wouldn't be easier to redirect the clients browser to the zip file?


Hi Daniel

the zip file is not in the web root and also should not be

> In
> addition is "application/zip" the correct mime type?
>

afaik yes, but i also testet with other file types, with the same
result.

> HTH,
>
> Daniel



  Réponse avec citation
Vieux 07/11/2007, 13h28   #4
Marcin Raczkowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send file from CGI

Detlef Reichl wrote:
> Am Montag, den 05.11.2007, 01:34 +0900 schrieb Daniel Völkerts:
>> Detlef Reichl schrieb:
>>
>> Hi Detlef,
>>> Any suggestions?
>>>
>>>

>> Wouldn't be easier to redirect the clients browser to the zip file?

>
> Hi Daniel
>
> the zip file is not in the web root and also should not be
>

why not? securing data this way is kinda stupid.

>> In
>> addition is "application/zip" the correct mime type?
>>

> afaik yes, but i also testet with other file types, with the same
> result.
>

acording to http://www.iana.org/assignments/media-types/ it's.

but some shity browsers (read IE wants file to have .zip extension even
if it's something like bleh.html?file=bloh.zip)



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h26.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,49643 seconds with 12 queries