Hmm.. I tried using your exact scripts, with the same permissions, and got the same problem.
I'm running under Dragonfly, and both files live under the /views/ sub-directory, could this be causing the problem?
EDIT: I checked by changing the code to:
Code: Select all
(set 'infile (open "./upload-file" "write"))
(println "<p> Writing file...")
(while (read-buffer (device) buffer 1024)
(println "<p>DOOD WE ARE IN YUR FILEZ WRITINGSZ" infile buffer))
(close infile)
And it never prints out the "DOOD" message, so there is something about the (while (read-buffer (device) buffer 1024) statement where it is never true. The uploaded file is there when I print $POST, however (I've checked with both text and image files) so the data is being sent somewhere, but maybe just isn't being stored in the buffer?
EDIT: I'm still trying to figure out what's going on, but I'm not sure what's happening in this code:
Code: Select all
; read data into intermediate file
(set 'infile (open "upload-file" "write"))
(while (read-buffer (device) buffer 1024)
(write-buffer infile buffer))
According to the manual, (device) is a shorthand for whatever file handle was recently opened (which I assume is (open "upload-file" "write)). But this is a temporary file, so there is nothing in it. The manual says that (read-buffer) works like this:
Code: Select all
Reads a maximum of int-size bytes from a file specified in int-file into a buffer in sym-buffer.
But if there is nothing in the file, why would it loop here at all? Isn't it reading from "upload-file" and copying everything in that file to the symbol "buffer"? But there is nothing in "upload-file" in the first place...
I mean, obviously the code works on your site, so the issue is somewhere else, like maybe my server configuration. But I don't understand what the code is trying to do here.