> 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.

The files can't be *entirely* arbitrary, there are a finite number of file 
extensions in use in the world.


> 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

The documentation is wrong, the type is taken from the browser.


> 2) Why does "write blob" cause an error if passed a MIME type it  
> doesn't understand?

Because 'write blob' does double duty for writing text in blobs and writing 
binary files. The only way I could determine which behavior to use (before 
Active4D 4.5) was to check the MIME type or file extension. In 4.5 I added the 
ability to force binary behavior.


> 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?

No. In retrospect the limitation of having a known MIME type is unnecessary 
beginning with v4.5 if binary output is forced, but there is nothing I can do 
about it now. The only solution available is to add a ton of entries to 
ExtensionMap.ini that will hopefully cover any file types you encounter. For an 
exhaustive list, see here:

https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

If the file does not have a type in that list, you'll have to use 
application/octet-stream when returning the file, which really isn't a big 
deal, since the OS on the client side really only cares about the filename 
extension.

Kind regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to