Mailing List Archive

Detecting partial uploading ?
Hi,

When uploading files by HTML FORM, (<input type=file>), the HTTP header
tells us the total Content-Length of the message, not the individual file
length.

EmbPerl allows us to save such files, but offers nothing to tell us if a
message is completely received, with at least a comparaison between the
total Content-Length and the actual received message length.

Any idea ?

z.wang@spidernet.tm.fr
RE: Detecting partial uploading ? [ In reply to ]
Hi,
>
> When uploading files by HTML FORM, (<input type=file>), the HTTP header
> tells us the total Content-Length of the message, not the individual file
> length.
>
> EmbPerl allows us to save such files, but offers nothing to tell us if a
> message is completely received, with at least a comparaison between the
> total Content-Length and the actual received message length.
>
> Any idea ?
>

Embperl provides you with all information that the CGI.pm uploadInfo
function provides. Look at the docs:

When you have installed CGI.pm 2.46 or above you may also retrieve the
filename (local filename, as it was on the browser side) and the
informations provied by the CGI.pm uploadInfo function. To get the filename
just print out the value of the correspondig %fdat entry, instead of using
it as a filehandle. To get the uploadInfo use the fieldname with a dash in
front of it:


Example:


# ImageName is the NAME of the field, you must replace it with whatever
# name is given in your HTML code
Filename: [+ $fdat{ImageName} +] <br>
Content-Type: [+ $fdat{-ImageName} -> {'Content-Type'} +] <br>

Maybe this helps?

Gerald