[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Uploading Word documents, PDFs, PNG files etc

From: Linas Vepstas
Subject: Re: Uploading Word documents, PDFs, PNG files etc
Date: Wed, 13 May 2009 14:23:21 -0500

2009/5/13 Sebastian Tennant <address@hidden>:

> Restricting regexps to actual text is fine... until you need to grep
> binary data, or, as in this case, a combination of text and binary data.

Last I looked, standard c-library posix/gnu/perl/java
regex only worked on strings, not on binary data.
You'll have trouble finding a binary-data regex
implementation in C (or any other language).

> in cgi.scm that extracted the uploaded (possibly binary) file, because
> the pattern identifying the beginning of the file in the raw data string
> is simple ("\n\r\n\r") -

No, this sounds somehow broken.  If I remember correctly,
binary mime-parts should have a ConentLength header
so you can skip over them. If ContentLength is absent,
then the part should bee ascii-encoded (e.g. base64)
yeah, grapping large blocks of ascii sucks, which is
why the ContetnLength should be used.

-- linas

reply via email to

[Prev in Thread] Current Thread [Next in Thread]