CFFILE action=upload seeing application/pdf file as typetext/html
3 Message(s) by 2 Author(s) originally posted in cfml discussion
| From: Adam Cameron |
Date: Thursday, October 25, 2007
|
All
<CFFILE action="upload "> does is move the
file from the web server's
temp dir to [wherever you specify]; it's more a "move" than an "upload".
And it's completely ignorant of
MIME type s (just like copying a file with
CTRl-C > CTRL-V in
Windows Explorer does not care either). The web server
handles the file upload from the client, not
ColdFusion ColdFusion *never* has any direct
communications with the client-end of
HTTP communications; all it does is
talk (or listen) to the web server. Has anything changed on your web
server?
--
Adam
| From: Henry K |
Date: Thursday, October 25, 2007
|
I have a strange
error that has occurred within the last month or so, but I
have just encountered it today.
CFFILE no longer recognizes the correct mime type of files.
I'm running CFMX 7,0,1,116466 on Windows XP,
Sun JM 1.4.2_05-b04
Code that worked a month ago, if not later (like a week ago) is now returning:
The MIME type of the uploaded file "text/html" wasn't accepted by the server.
Only files of type "application/pdf" can be uploaded.
Verify that you are uploading a file of the appropriate type.
Am I missing something here? I do not think so, because
code that used to work
is no longer working.
I have attached some test code that will also result in error.
test file 1, fileUploadTest.cfm:
<form method="post" action="actFileUploadTest.cfm" name="uploadForm"
enctype="multipart/form-data">
<input name="pdfFileToUpload" type="file">
<br>
<input name="submit" type="submit" value="Upload File">
</form>
post action file:
<CFOUTPUT>
<CFSET destinationDir = "/path/to/an/upload/directory" >
<CFSET mimeAcceptList = "application/pdf">
<CFFILE action = "upload"
fileField = "pdfFileToUpload"
destination = "#destinationDir#"
accept = "#mimeAcceptList#"
nameConflict = "MakeUnique">
</CFOUTPUT>
| From: Henry K |
Date: Friday, October 26, 2007
|
Thanks for the response, Adam!
I checked with the admin, no changes were made to any of the servers, web or
cfmx, or to the jvm.
So I had to think about it and the only thing that changed was....my
version
of
Firefox !
After
testing it out I think this is an issue with Firefox 2.0.0.8 (tested
only on windows), because the code works fine with IE 7, and on a version of FF
on OS X.
Firefox 2.0.0.8 is reporting files of type application/pdf as text/html.
Next Message: Can CF8 exist in an virtual machine environment