http://www.udev.info
Mail/Login: Password : forgot my password!
[UPDATE MODE]
Back

Delivering files as a download with Uniface

Direct link http://www.udev.info/uniface/delivering-files-as-a-download-with-uniface
Written by -GHAN- // Tags: files download uniface fix status ajax

You all know this web feature: There is a file which is bound to some content and you want to deliver it to the user as a download. But how can we deliver this with Uniface? Three simple steps to success ...

Step 1: load the file into a variable

Define a bunch of variables and one as a RAW type. Use (l)fileload to get the data into it.
SOURCE CODE
Sorry- ... please log-in or register to get this!


Step 2: preparing the http response headers

The browser needs some special response to figure what you want it to do. Here we have to do a bit more than just say "dude, next up is a binary file". Problems are caused by IE6 as it is very strange in its needs here. Take a look at the following code:
SOURCE CODE
Sorry- ... please log-in or register to get this!


Step 3: delivering the data

Finally we only need to put the content of the file (above stored in vrawdata) to the output channel and that's it!
SOURCE CODE
Sorry- ... please log-in or register to get this!

(Thanx to Jas for the initial hint on that)

Strange effects with Uniface 9.x

If you encounter some strange behaviour and the data wont be delivered ALLTHOUGH it's fine then this could be a bug within the WRD.JAR version 2243 (if I remember right). The effect turns to be some strange status values which make it into $webinfo("status") somehow.
I've spend 3 days by now investigating this and walking through the deepest deep in our software to find out, whats happening. Finally Chris helped me in my struggle and told me to try override it manually ...I did! And so it worked as wanted! Here is the little but time saving fix for this!
SOURCE CODE
Sorry- ... please log-in or register to get this!

This should happen pretty frequently, here and there. I even patched GHANIFIED! AJAX core to stay in control of this! :/ When this is fixed, I'll place a note here ...

(Thanx to Chris for the tech talk on that case)

Comments

866 view(s) / 2010-03-01 13:27:37 / LAST UPDATED: 2010-09-29 11:35:23