Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl
Problem with file upload
 

Index | Next | Previous | View Flat


embperl at thefreecat

Sep 30, 2008, 6:48 AM


Views: 2664
Permalink
Problem with file upload

Hello,

I have a fully UTF8 encoded site in which I want users to upload files
(simple <input type="file...> form).
These files are ISO-8859-1 encoded.

My problem is that sometimes the file is correctly uploaded and
sometimes it is converted to something stupid :

==>correct :
$ hd sconet1.csv |head -1
00000000 4e 6f 6d 3b 50 72 e9 6e 6f 6d 20 31 3b 44 61 74 |Nom;Pr.nom 1;Dat|

==>bad :
$ hd sconet1.csv |head -1
00000000 4e 6f 6d 3b 50 72 ef bf bd 6e 6f 6d 20 31 3b 44 |Nom;Pr...nom 1;D|

The problem seems completely random, sometimes pressing F5 a few times makes
the upload work.

The code I use is this :
open(FILE,">:encoding(iso-8859-1)","sconet1.csv") or print OUT $!;
my $buffer;
while (read($fdat{efilename},$buffer,32768)) {
print FILE $buffer;
}
close(FILE);

I have tried removing the second param to open() but it changes nothing.

The problem arises in Firefox and IE so I guess the problem is server-side.

At the beginning of _base.epl I have this :
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

Can I force a "pure binary" upload/save of the file ?

*any* clue much appreciated. I'm getting mad with this...

Thanks,

JC

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe[at]perl.apache.org
For additional commands, e-mail: embperl-help[at]perl.apache.org

Subject User Time
Problem with file upload embperl at thefreecat Sep 30, 2008, 6:48 AM
    Re: Problem with file upload luiz at engenhosolucoes Sep 30, 2008, 7:37 AM
    Re: Problem with file upload bhiebert at press Sep 30, 2008, 10:14 AM
        Re: Problem with file upload embperl at thefreecat Sep 30, 2008, 4:59 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.