[Zope] content type of file reverts from text/html to
dieter at handshake.de
Sat Oct 13 12:55:55 EDT 2007
Justin Olmanson wrote at 2007-10-13 00:51 +0000:
>I have a story writing application. Users click a creat story button and it
>creates a file like so...
> the_folder.manage_addFile(the_id, file="<html></html>", title="",
>This works fine the file is created and is of the content type text/html
>However when the user edits the story using epoz and saves it the file
>content type changes to application/octet-stream here is the update
>script called from a dtml method called 'edit' with the url being
> ''' this function updates the object contents on which it is called '''
> htPlus = "<html><head><title>" + title1 + "</title></head><body>" + ht
"manage_upload" tries to set the content type.
If it gets a "FileUpload" instance as argument, then
this instance contains (usually) the content type information
and "manage_upload" will use this. Otherwise, it tries to determine
the content type from its "__name__" (which means its id) or the
content and falls back to "application/octet-stream" if it fails.
As you can see, it fails in your case...
The code is in "OFS.Image.File._get_content_type".
More information about the Zope