[Top][All Lists]

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

Uploading Word documents, PDFs, PNG files etc

From: Sebastian Tennant
Subject: Uploading Word documents, PDFs, PNG files etc
Date: Sun, 10 May 2009 16:21:29 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Hi Guilers,

The following works fine for plain text files but fails with Word
documents, PDFs, PNG files and no doubt other (binary?) file types.

This error msg, followed by the contents of the file, is dumped on
stderr each time:

 string contains #\nul character: "\x0d
 Content-Disposition: form-data; name=\"File-Upload\"; 
 Content-Type: image/png\x0d


 (use-modules (www cgi))


 (let* ((upload (cgi:upload "File-Upload"))
        (props-alist (object-property upload #:guile-www-cgi))
        ;;(object-property ...) is deprecated
        (upload-fname (transform-string
                       (assoc-ref props-alist #:filename)
                       #\  #\_)))
   (with-output-to-file (string-append USER-UPLOAD-DIR upload-fname)
     (lambda ()
       (display upload)))))


How should I go about getting uploaded binary files out of memory and
onto disk?

Any help/advice/pointers much appreciated.


P.S. 'Writing' rather than 'displaying' the uploaded file makes no
     difference (and is not what I want).

Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.

reply via email to

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