guile-user
[Top][All Lists]
Advanced

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

Re: Uploading Word documents, PDFs, PNG files etc


From: Sebastian Tennant
Subject: Re: Uploading Word documents, PDFs, PNG files etc
Date: Tue, 19 May 2009 04:48:13 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Hi Ludo,

Thanks for responding.  I know this isn't really your 'thing' (for want
of a better word).

Quoth address@hidden (Ludovic Courtès):
>> cgi.scm currently uses the following patterns and I can't think of an
>> alternative way of doing it:
>>
>>  (let ((name-rx     (make-regexp "name=\"([^\"]*)\""))
>>        (filename-rx (make-regexp "filename=\"*([^\"\r]*)\"*"))
>>        (type-rx     (make-regexp "Content-Type: ([^\r]*)\r\n" regexp/icase))
>>        (value-rx    (make-regexp "\r\n\r\n")))
>>    ...)
>
> Can't this be applied just to the header part of the blob rather than to
> the whole blob, including binary data?

The problem is that there's no way of being sure how many header lines
will precede the (possibly) binary blob in any given part (RFC 2388).

 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"TABLE\"\x0d
 \x0d
 \x0d
 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"File-Upload\"; 
filename=\"null-char.txt\"\x0d
 Content-Type: text/plain\x0d
 \x0d
 address@hidden
 \x0d
 -----------------------------1307099961880952181245320094\x0d
 Content-Disposition: form-data; name=\"Button\"\x0d
 \x0d
 Upload\x0d
 -----------------------------1307099961880952181245320094--\x0d

Content-Disposition is mandatory, but Content-Type is optional
(defaulting to text/plain) as is Content-Transfer-Encoding, so the
"header part" of any given MIME part may be a single line or it may be
three.


Seb
-- 
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap





reply via email to

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