Hello all, I'm implementing a feature where (to greatly over-simplify things) users can upload files to us, and later retrieve these same files. Because these files are entirely arbitrary, I can't reasonably expect that a file the user sends to me will be represented in ExtensionMap.ini.
So, when I receive the upload, I use "get upload content type()" to get the MIME type of the file they user is sending, and I store this MIME type in a DB table along with the file in a BLOB. That works fine. However, when I go to use "write blob()" to return this file to them, I run into a situation where the stored MIME type isn't recognized, and Active4D errors the page out as a result. As a workaround, I've resorted to always using a type of "application/octet-stream" no matter what the file is, but I'd really rather set the type appropriately when possible. So, to get the point I have three main questions: 1) The documentation for "get upload content type()" says it returns a MIME type based on the file extension, which implies that it uses ExtensionMap.ini to determine a MIME Type. However, in practice this doesn't seem to be true. It appears that it actually will return the MIME Type that the browser asserted when the file was uploaded (whether it's present in ExtensionMap.ini or not). This isn't really a problem, except that: 2) Why does "write blob" cause an error if passed a MIME type it doesn't understand? I want to send back binary data using the type that I received the file as. (Using octet-stream if I don't know of course) Shouldn't it return 'false' on failure or something similar so I can react to it? 3) I may have overlooked it, but if "write blob" really needs to understand the MIME type to function, is there some method I can call to test whether my type is supported before I crash my script? I had thought that if I received a valid type from "get upload content type()" that I could count on "write blob()" accepting it, but this isn't the case. Our software configuration: 4D Server 2004 (8.0.7) on a PPC XServe Active4D 4.0.2 (4D Server Acting as Webserver) Thanks for any insight, Chris Backas Bristol Capital, Inc. CONFIDENTIALITY NOTICE: This email (and any related attachments) contains information from InfoPlus (a service of Bristol Capital, Inc.). It is intended only for the addressee and may contain information that is confidential and/or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or are acting as agent for the intended recipient, any use or disclosure of this communication is prohibited. If you have received this communication in error, please notify me immediately to arrange for the appropriate method of returning or disposing of the communication. If our respective Companies have confidentiality provisions in effect, this email and the materials contained herein are deemed CONFIDENTIAL and should be treated accordingly unless expressly provided otherwise. _______________________________________________ Active4D-dev mailing list [email protected] http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
