plugins.file.writeTXTFile, file extensions and mime types

Now that plugins.file.writeTXTFile is web compatible I think there is a need for optional parameters to specify both the file extension (or atleast not auto-append .txt to everything) and the mime type. I think it is not too reasonable to assume that the use of writeTXTFile in webclient will be restricted to only .txt files and mime type text/plain.

Maybe I’m missing something?

See the discussion on the plugins site: http://groups.google.com/group/servoy-j … rts-plugin

Rob

Also: writeTXTFile is explicitly for writing text files. If you want to write binary files, use writeFile instead.

Paul

Hi Paul thanks for the reply. I understand the difference between write txt file and write file API, but I think you are missing my point. Say for example I want to write a csv file to client via webclient and writetxtfile. Csv is a text format and not binary. The trouble is though that writetxtfile always pushes a text plain mime type and auto appends .txt to everything! Couldn’t that be changed so that we could specify a diffferent mime type that corresponded to the appropriate file type we are creating? This way I can call writetxtfile with an extension and a mime type and the browser will push the appropriate header corresponding to the file type.

I am bringing this up because right now it seems as though combining writetxtfile with jasper plugins runreport and specifying csv - to download a csv report to the client in Webclient - can’t work.

we dont append txt to everything, i guess the browser does that for you.
in 5.1 we push the file name that you give.

But we could add an extra param to writeTXTFile where you can give us the right mimetype. (same maybe for binary data, there we look already at the data itself to get the mime type)

make a case for this.