plugins.file.writeTXTFile, file extensions and mime types

Forum to discuss the Web client version of Servoy.

plugins.file.writeTXTFile, file extensions and mime types

Postby jbader » Tue Apr 06, 2010 9:24 pm

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?
jbader
 
Posts: 520
Joined: Sun Sep 18, 2005 4:24 am
Location: Miami, FL

Re: plugins.file.writeTXTFile, file extensions and mime types

Postby rgansevles » Wed Apr 07, 2010 8:59 am

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

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: plugins.file.writeTXTFile, file extensions and mime types

Postby pbakker » Wed Apr 07, 2010 9:08 am

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

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: plugins.file.writeTXTFile, file extensions and mime types

Postby jbader » Wed Apr 07, 2010 1:09 pm

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.
jbader
 
Posts: 520
Joined: Sun Sep 18, 2005 4:24 am
Location: Miami, FL

Re: plugins.file.writeTXTFile, file extensions and mime types

Postby jcompagner » Wed Apr 07, 2010 3:42 pm

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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 23 guests

cron