Vitaliy Serdtsev · Jul 10, 2017 go to post
Could the issue be something with the dataBinding?
Most likely - yes, see <dataController> Methods. Simple example:
Class demo.relationModel Extends %ZEN.DataModel.ObjectDataModel
{

</FONT><FONT COLOR="#000080">Property </FONT><FONT COLOR="#000000">Relation </FONT><FONT COLOR="#000080">As %String</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">MAXLEN </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">36</FONT><FONT COLOR="#000000">);

</FONT><FONT COLOR="#000080">Method </FONT><FONT COLOR="#000000">%OnLoadModel(</FONT><FONT COLOR="#ff00ff">pSource </FONT><FONT COLOR="#000080">As %RegisteredObject</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">As %Status </FONT><FONT COLOR="#000000">{   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#000000">..</FONT><FONT COLOR="#0000ff">Relation </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$g</FONT><FONT COLOR="#000000">(^tmp,</FONT><FONT COLOR="#008000">"BLACKFIN CAPITAL PARTNERS"</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#0000ff">q $$$OK </FONT><FONT COLOR="#000000">}

</FONT><FONT COLOR="#000080">Method </FONT><FONT COLOR="#000000">%OnStoreModel(</FONT><FONT COLOR="#ff00ff">pSource </FONT><FONT COLOR="#000080">As %RegisteredObject</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">As %Status </FONT><FONT COLOR="#000000">{   </FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#000000">^tmp   </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#000000">^tmp=..</FONT><FONT COLOR="#0000ff">Relation   q $$$OK </FONT><FONT COLOR="#000000">} }</FONT>

<FONT COLOR="#000080">Class demo.test Extends %ZEN.Component.page </FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">] { <</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#800000">title</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">""</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">dataController     </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"relationData"     </FONT><FONT COLOR="#800000">modelClass</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"demo.relationModel"   </FONT><FONT COLOR="#000000">/>   <</FONT><FONT COLOR="#000080">form     </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"MyForm"     </FONT><FONT COLOR="#800000">controllerId</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"relationData"   </FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">text       </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Relation"       </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Relation"       </FONT><FONT COLOR="#800000">name</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Relation"       </FONT><FONT COLOR="#800000">dataBinding</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Relation"       </FONT><FONT COLOR="#800000">size</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"36"     </FONT><FONT COLOR="#000000">/>     <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"1. Convert" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.convertToTitle();"</FONT><FONT COLOR="#000000">/>     <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"2. Save" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zen('MyForm').save();" </FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">form</FONT><FONT COLOR="#000000">> </</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">convertToTitle() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">controller </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'relationData'</FONT><FONT COLOR="#000000">);      controller.setDataByName(</FONT><FONT COLOR="#800000">'Relation'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.stringConvert(zen(</FONT><FONT COLOR="#800000">'Relation'</FONT><FONT COLOR="#000000">).getValue()));   controller.raiseDataChange(); }

</FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">stringConvert(</FONT><FONT COLOR="#ff00ff">str</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">///alert (str)   </FONT><FONT COLOR="#000000">str </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">str.substring(</FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">).toLowerCase() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">str.substring(</FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">).toLowerCase();   </FONT><FONT COLOR="#008000">///alert (str)   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">pieces </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">str.split(</FONT><FONT COLOR="#800000">" "</FONT><FONT COLOR="#000000">);   </FONT><FONT COLOR="#008000">for </FONT><FONT COLOR="#000000">( </FONT><FONT COLOR="#008000">var </FONT><FONT COLOR="#000000">i </FONT><FONT COLOR="#000080">= 0</FONT><FONT COLOR="#000000">; i </FONT><FONT COLOR="#000080">< </FONT><FONT COLOR="#000000">pieces.length; i</FONT><FONT COLOR="#000080">++ </FONT><FONT COLOR="#000000">)   {     </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">j </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">pieces[i].charAt(</FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">).toUpperCase();          pieces[i] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">j </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">pieces[i].substr(</FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">);   }          </FONT><FONT COLOR="#008000">return </FONT><FONT COLOR="#000000">pieces.join(</FONT><FONT COLOR="#800000">" "</FONT><FONT COLOR="#000000">); } }</FONT>

Vitaliy Serdtsev · Jul 11, 2017 go to post

Thanks, fixed the code. Now <FONT COLOR="#0000ff">$$$TAB </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#0000ff">$C</FONT><FONT COLOR="#000000">(9)</FONT>

Vitaliy Serdtsev · Jul 13, 2017 go to post

It's the wrong solution, because it works not for all cases such as this:

<FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">Text</FONT><FONT COLOR="#000000">(1) = </FONT><FONT COLOR="#008000">"Planet"
</FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">Text</FONT><FONT COLOR="#000000">(2) = </FONT><FONT COLOR="#008000">"Championship"
</FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">Text</FONT><FONT COLOR="#000000">(3) = </FONT><FONT COLOR="#008000">"2017"
</FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">Text</FONT><FONT COLOR="#000000">(4) = </FONT><FONT COLOR="#008000">"IT"</FONT>
Here is more optimized code Sean:
<FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">Main(</FONT><FONT COLOR="#000080">ByRef </FONT><FONT COLOR="#ff00ff">Text</FONT><FONT COLOR="#000000">)
{
</FONT><FONT COLOR="#d3d3d3"> f j=2:1:$o(Text(""),-1) f k=j:-1:2 s l=$l(Text(k))+1,$e(Text(k),l)=$e(Text(k-1),l,),$e(Text(k-1),l,)=""</FONT>
<FONT COLOR="#000000">}</FONT>
Vitaliy Serdtsev · Jul 13, 2017 go to post

What exactly did you do? Quote from doc:

By default, the session timeout is to 900 seconds (15 minutes). You can change this default for a CSP application in the Management Portal; [Home] > [Security] > [Web Applications] page. Select the application and click Edit.

Note that if a session changes CSP applications during its life span, its timeout value will not be updated according to the default timeout defined in the application that the session moved into. For example, if a session starts out in CSP Application A, with a default timeout of 900 seconds, and then moves into CSP Application B, which has a default timeout of 1800 seconds, the session will still timeout after 900 seconds.

Check these points. Still see the page parameter AUTOLOGOUT.
Vitaliy Serdtsev · Jul 13, 2017 go to post

Personally, I prefer to use all out of the box, so as not to produce zoo libraries/technologies/languages, etc.

Really, both operations possible to execute at a time, for instance so:

<FONT COLOR="#0000ff">w $$$FormatText</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"Create a signature and convert it to base64 (%1)"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">file64</FONT><FONT COLOR="#000000">),!
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">cmd</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$FormatText</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"openssl dgst -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:-1 -sign %1 %2 | openssl base64 -out %3 -nopad"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">fileKey</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">fileMsg</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">file64</FONT><FONT COLOR="#000000">)
</FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#800000">cmd</FONT><FONT COLOR="#000000">,!!
</FONT><FONT COLOR="#0000ff">d $zf</FONT><FONT COLOR="#000000">(-1,</FONT><FONT COLOR="#800000">cmd</FONT><FONT COLOR="#000000">)</FONT>
Vitaliy Serdtsev · Jul 18, 2017 go to post
The solution with ##class(%xsd.hexBinary).LogicalToXSD works, but be careful, it only works when all characters in the string have codes <256.
All right, because the function works with an array of bytes (binary). Therefore pre-to need lead N-byte string to single-byte string and only then do the conversion, for example:
trantable="SAME","UTF8" {
 "-------",!,trantable,!
 xN="π=3.14159..." zzdump xN !
 x1=$zcvt(xN,"O",trantablezzdump x1 !!
     
 hex=##class(%xsd.hexBinary).LogicalToXSD(x1)
 zw hex
     
 w $zcvt(##class(%xsd.hexBinary).XSDToLogical(hex),"I",trantable),!!
}

USER><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000000">^test</FONT>

SAME

0000: 03C0 003D 0033 002E 0031 0034 0031 0035 π=3.1415 0008: 0039 002E 002E 002E 9...

0000: C0 03 3D 00 33 00 2E 00 31 00 34 00 31 00 35 00 À.=.3...1.4.1.5. 0010: 39 00 2E 00 2E 00 2E 00 9.......

hex="C0033D0033002E00310034003100350039002E002E002E00" π=3.14159...


UTF8

0000: 03C0 003D 0033 002E 0031 0034 0031 0035 π=3.1415 0008: 0039 002E 002E 002E 9...

0000: CF 80 3D 33 2E 31 34 31 35 39 2E 2E 2E Ï.=3.14159...

hex="CF803D332E31343135392E2E2E" π=3.14159...

Vitaliy Serdtsev · Jul 18, 2017 go to post
  1. Non-optimal plan does not necessarily mean low speed. I have had cases where the query with the best plan to work longer than a query with worse plan.
  2. Now the optimizer is pretty advanced. Important to periodically make tuning table and add an index on each field involved in the search.
  3. When unknown parameters >5, is easier to do one query than to write a bunch of code.
Vitaliy Serdtsev · Jul 18, 2017 go to post
I didn't know that Caché allowed to use JOINs without specifying FROM.
JOIN or SELECTOptional FROM Clause?

But it should be noted that for JOIN not all usages are supported, for example:

Supported:

<FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#000080">* FROM    </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'aaa' </FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'bbb' </FONT><FONT COLOR="#008000">Column2 </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'ccc'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'ccc' </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'xxx'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'yyy' </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'hhh'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'zzz'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">Table1 </FONT><FONT COLOR="#000080">LEFT OUTER JOIN   </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'ggg' </FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'hhh' </FONT><FONT COLOR="#008000">Column3 </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'xxx'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'zzz'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">Table2 </FONT><FONT COLOR="#000080">ON </FONT><FONT COLOR="#008000">Table1</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">Table2</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">Column3</FONT>

Not supported:

<FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#000080">* FROM    </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'aaa' </FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'bbb' </FONT><FONT COLOR="#008000">Column2 </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'ccc'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'ccc' </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'xxx'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'yyy' </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'hhh'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'zzz'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">Table1 </FONT><FONT COLOR="#000080">INNER JOIN    </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'ggg' </FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'hhh' </FONT><FONT COLOR="#008000">Column3 </FONT><FONT COLOR="#000080">union </FONT><FONT COLOR="#0000ff">select </FONT><FONT COLOR="#008080">'xxx'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008080">'zzz'</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#008000">Table2 </FONT><FONT COLOR="#000080">USING </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">Column1</FONT><FONT COLOR="#000000">)</FONT>

Vitaliy Serdtsev · Jul 20, 2017 go to post

There is a method $system.Memory.Clean(<cleancache>, <defragment>), but unfortunately it appeared only with version 2011.1.

Try this code (consider that LONGVARCHAR = %Stream.GlobalCharacter) Read a CLOB through JDBC:

try{   ByteArrayOutputStream bos = new ByteArrayOutputStream();   Statement st = dbconn.createStatement();   ResultSet rs = st.executeQuery("Select ID,Text from eprinstance.isegment");     while (rs.next())   {     int len;     Reader reader = rs.getCharacterStream("Text");     while ((len = reader.read()) != -1)       bos.write(len);       System.out.println(bos);       reader.close();     bos.reset();   }     bos.close();   st.close();   rs.close();     System.out.println("OK!");} finally{   dbconn.close();}
Vitaliy Serdtsev · Jul 25, 2017 go to post

You can fix this error directly now, if you don't want to wait for the release of version 2018.1.1.

To do this, follow these steps:

  1. make export the locale "deuw"
    %SYS>Locales("deuw")="" d $system.OBJ.DisplayError(##class(Config.NLS.Locales).ExportList("loc_deuw.xml",.t,.Locales)) zw Locales,t
  2. fix the file loc_deuw.xml (by default located in the folder %CACHEHOME%\Mgr)
    Name of subtable (Where to insert)New lines (That to insert)
    Add the following lines to the appropriate subtables:
    COL-German3-Unicode<FromToItem FromToKey="55,55,1">83,83;</FromToItem> <FromToItem FromToKey="55,55,2">7838;</FromToItem> <FromToItem FromToKey="55,55,3">83,7838;</FromToItem>
    COL-Unicode-German3<FromToItem FromToKey="7838">55,55;2</FromToItem> <FromToItem FromToKey="83,83">55,55;1</FromToItem> <FromToItem FromToKey="83,7838">55,55;3</FromToItem>
    LowerCase-Unicode-Unicode<FromToItem FromToKey="7838">223</FromToItem>
    UpperCase-Unicode-Unicode<FromToItem FromToKey="223">7838</FromToItem>
  3. import fixed loc_deuw.xml:
    %SYS>d $system.OBJ.DisplayError(##class(Config.NLS.Locales).ImportAll("loc_deuw.xml",.t,1+2+4)) zw t
    %SYS>d $system.OBJ.DisplayError(##class(Config.NLS.Locales).Compile("deuw"))
    %SYS>Locale^NLSLOAD("deuw")
    Just in case, restart Caché.
Now, run a small test
#include %systemInclude
#include %occErrors
#include %syNLS
test() public {
  
  #dim ex As %Exception.AbstractException

  </FONT><FONT COLOR="#0000ff">try </FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">$$$AddAllRoleTemporaryInTry     n $namespace     s $namespace</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"%SYS"          </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">oldLocale</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$LOCALENAME     w </FONT><FONT COLOR="#008000">"Old locale = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">oldLocale</FONT><FONT COLOR="#000000">,!     </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">Config.NLS.Locales</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">Install</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"deuw"</FONT><FONT COLOR="#000000">)     </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"Current locale = "</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$LOCALENAME</FONT><FONT COLOR="#000000">,!!          </FONT><FONT COLOR="#0000ff">k </FONT><FONT COLOR="#000000">^||low,^||up

    </FONT><FONT COLOR="#0000ff">f </FONT><FONT COLOR="#800000">w</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"wei"</FONT><FONT COLOR="#000000"></FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(223)</FONT><FONT COLOR="#008000">"er"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"weiter"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"weiser" </FONT><FONT COLOR="#800080">{       </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#000000">^||low(</FONT><FONT COLOR="#0000ff">$zcvt</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">w</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"L"</FONT><FONT COLOR="#000000">))=1       </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#000000">^||up(</FONT><FONT COLOR="#0000ff">$zcvt</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">w</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"U"</FONT><FONT COLOR="#000000">))=1     </FONT><FONT COLOR="#800080">}     </FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#000000">^||low,^||up          </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">low</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(223)     </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">up</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$zcvt</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">low</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"U"</FONT><FONT COLOR="#000000">)     </FONT><FONT COLOR="#0000ff">zw </FONT><FONT COLOR="#800000">low</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">up     </FONT><FONT COLOR="#0000ff">zzdump </FONT><FONT COLOR="#800000">low</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">up        </FONT><FONT COLOR="#800080">}</FONT><FONT COLOR="#0000ff">catch</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{     </FONT><FONT COLOR="#0000ff">w </FONT><FONT COLOR="#008000">"Error "</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">ex</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">DisplayString</FONT><FONT COLOR="#000000">(),!   </FONT><FONT COLOR="#800080">}   </FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">Config.NLS.Locales</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">Install</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">oldLocale</FONT><FONT COLOR="#000000">)

</FONT><FONT COLOR="#800080">}</FONT>

My result:

USER>d ^test
Old locale = rusw
Current locale = deuw

^||low("weiser")=1 ^||low("weißer")=1 ^||low("weiter")=1 ^||up("WEISER")=1 ^||up("WEIẞER")=1 ^||up("WEITER")=1 low="ß" up="ẞ"

0000: DF ß 0000: 1E9E ẞ

Vitaliy Serdtsev · Oct 5, 2017 go to post

Yes, checked and it works in IE11 (see screenshot).
In addition, you can find in the file zenutils.js the following code:

if (zenIsIE && (!(((typeof zenIsHTML5 != 'undefined'&& zenIsHTML5) && ((typeof document.documentMode != 'undefined'&& document.documentMode==9)))) {
  <...>
  window.document.body.onload function(event) { return zenPageEventHandler('onload',event); }
  window.document.body.onbeforeunload function(event) { return zenPageEventHandler('onunload',event); }
  <...>
}

Googling "onbeforeunload не работает" or "onbeforeunload javascript not working".

Vitaliy Serdtsev · Oct 6, 2017 go to post

It also can be solved.

The behavior of zenPage.launchPopupWindow depends on the setting useSoftModal.

Play around with %OnUseSoftModals in the following example:

Class dc.demo Extends %ZEN.Component.page
{

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Style { <</FONT><FONT COLOR="#000080">style </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"text/css"</FONT><FONT COLOR="#000000">> </FONT><FONT COLOR="#800000">.</FONT><FONT COLOR="#000080">modalGroupCloseButton </FONT><FONT COLOR="#800000">{   </FONT><FONT COLOR="#000080">background-color</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">green</FONT><FONT COLOR="#800000">;   </FONT><FONT COLOR="#000080">filter</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">alpha(opacity=</FONT><FONT COLOR="#800000">20);   </FONT><FONT COLOR="#000080">opacity</FONT><FONT COLOR="#800000">: 0.2; } .</FONT><FONT COLOR="#000080">modalGroupCloseButtonHover </FONT><FONT COLOR="#800000">{   </FONT><FONT COLOR="#000080">background-color</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">green</FONT><FONT COLOR="#800000">; } </FONT><FONT COLOR="#000000"></</FONT><FONT COLOR="#000080">style</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">CSS3Style { <</FONT><FONT COLOR="#000080">style </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"text/css"</FONT><FONT COLOR="#000000">> </FONT><FONT COLOR="#800000">.</FONT><FONT COLOR="#000080">modalGroupCloseButton </FONT><FONT COLOR="#800000">{   </FONT><FONT COLOR="#000080">background-color</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">red</FONT><FONT COLOR="#800000">;   </FONT><FONT COLOR="#000080">opacity</FONT><FONT COLOR="#800000">: 0.2; } .</FONT><FONT COLOR="#000080">modalGroupCloseButtonHover </FONT><FONT COLOR="#800000">{   </FONT><FONT COLOR="#000080">background-color</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">red</FONT><FONT COLOR="#800000">; } </FONT><FONT COLOR="#000000"></</FONT><FONT COLOR="#000080">style</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">] { <</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen"</FONT><FONT COLOR="#000000">> <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Show modal" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.showModal()"</FONT><FONT COLOR="#000000">/> </</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">> }

</FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">showModal() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">!</FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.isPopup) {     zenPage.launchPopupWindow(window.location.href,</FONT><FONT COLOR="#800000">'DEMO MODAL'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">'center=yes,resizable=no,width=320,height=240'</FONT><FONT COLOR="#000000">);          </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">els</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">document.body.getElementsByClassName(</FONT><FONT COLOR="#800000">'modalGroupClose'</FONT><FONT COLOR="#000000">);     </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(els.length</FONT><FONT COLOR="#000080">>0</FONT><FONT COLOR="#000000">) els[</FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">].onclick</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">zenPage.onhideGroupHandler;   } }

</FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">onhideGroupHandler() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(confirm(</FONT><FONT COLOR="#800000">'[1] Are you sure you want to leave?'</FONT><FONT COLOR="#000000">)) {     </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">modalGroup</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">zenPage.modalStack[zenPage.modalStack.length </FONT><FONT COLOR="#000080">- 1</FONT><FONT COLOR="#000000">];     modalGroup.hideGroup();   } }

</FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">onunloadHandler(</FONT><FONT COLOR="#ff00ff">e</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">message </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">"[2] Are you sure you want to leave?"</FONT><FONT COLOR="#000000">;

  </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">typeof </FONT><FONT COLOR="#000000">e </FONT><FONT COLOR="#000080">== </FONT><FONT COLOR="#800000">"undefined"</FONT><FONT COLOR="#000000">) {       e </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">window.event;   }   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(e) {       e.returnValue </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">message;   }   </FONT><FONT COLOR="#008000">return </FONT><FONT COLOR="#000000">message; }

</FONT><FONT COLOR="#000080">/// Return whether the current page should use soft modal divs. /// The default behaviour is to return 1 for the current instance, but users may set the /// ^%ISC.ZEN.useSoftModals global change this system-wide. /// In some cases, it may be worth modifying the value of the flag based on /// the user agent, particularly if users are expected to access the application /// from mobile devices where new windows behave differently. ClassMethod </FONT><FONT COLOR="#000000">%OnUseSoftModals() </FONT><FONT COLOR="#000080">As %Boolean </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">CodeMode </FONT><FONT COLOR="#000000">= expression ] { </FONT><FONT COLOR="#0000ff">$$$YES </FONT><FONT COLOR="#000000">}

</FONT><FONT COLOR="#000080">/// This callback method determines lets a page specify level of CSS support is used by this page. /// The default is to return "", which indicates that the built-in ZEN CSS level /// detection is used. A page can override this and return 2 or 3. Method </FONT><FONT COLOR="#000000">%OnDetermineCSSLevel() </FONT><FONT COLOR="#000080">As %Integer </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">CodeMode </FONT><FONT COLOR="#000000">= expression ] { 3 }

}</FONT>

Vitaliy Serdtsev · Oct 16, 2017 go to post

Isn't it easier to use the built function StringMin, especially when its the code does exactly the same thing?

USER><FONT COLOR="#0000ff">w $length</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%PopulateUtils</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">StringMin</FONT><FONT COLOR="#000000">(100,100))</FONT>
100
Source code:
<FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">StringMin(
  </FONT><FONT COLOR="#ff00ff">minlen </FONT><FONT COLOR="#000080">As %Integer </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">,
  </FONT><FONT COLOR="#ff00ff">maxlen </FONT><FONT COLOR="#000080">As %Integer </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">As %String </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">ProcedureBlock </FONT><FONT COLOR="#000000">= 1 ]
{
 </FONT><FONT COLOR="#0000ff">if </FONT><FONT COLOR="#800000">maxlen </FONT><FONT COLOR="#000000">'< </FONT><FONT COLOR="#800000">minlen </FONT><FONT COLOR="#800080">{
   </FONT><FONT COLOR="#0000ff">set </FONT><FONT COLOR="#800000">len</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$$$PRand</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">maxlen</FONT><FONT COLOR="#000000">-</FONT><FONT COLOR="#800000">minlen</FONT><FONT COLOR="#000000">+1)+</FONT><FONT COLOR="#800000">minlen</FONT><FONT COLOR="#000000">,
       </FONT><FONT COLOR="#800000">string</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">""
   </FONT><FONT COLOR="#0000ff">for </FONT><FONT COLOR="#800000">i</FONT><FONT COLOR="#000000">=1:1:</FONT><FONT COLOR="#800000">len </FONT><FONT COLOR="#800080">{
     </FONT><FONT COLOR="#0000ff">Set </FONT><FONT COLOR="#800000">charn</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#0000ff">$s</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">$$$PRand</FONT><FONT COLOR="#000000">(2):</FONT><FONT COLOR="#0000ff">$$$PRand</FONT><FONT COLOR="#000000">(26)+65,1:</FONT><FONT COLOR="#0000ff">$$$PRand</FONT><FONT COLOR="#000000">(26)+97),
         </FONT><FONT COLOR="#800000">string</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">string</FONT><FONT COLOR="#000000">_</FONT><FONT COLOR="#0000ff">$s</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">charn</FONT><FONT COLOR="#000000"><123:</FONT><FONT COLOR="#0000ff">$c</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">charn</FONT><FONT COLOR="#000000">),1:</FONT><FONT COLOR="#008000">" "</FONT><FONT COLOR="#000000">)
   </FONT><FONT COLOR="#800080">}
   </FONT><FONT COLOR="#0000ff">quit </FONT><FONT COLOR="#800000">string
 </FONT><FONT COLOR="#800080">} </FONT><FONT COLOR="#0000ff">else </FONT><FONT COLOR="#800080">{ </FONT><FONT COLOR="#0000ff">quit </FONT><FONT COLOR="#008000">"" </FONT><FONT COLOR="#800080">}
</FONT><FONT COLOR="#000000">}</FONT>
Vitaliy Serdtsev · Oct 18, 2017 go to post

There is a difference:

NameHome_Street
<FONT COLOR="#000080">ORDER BY </FONT><FONT COLOR="#008000">%MVR</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">Home_Street</FONT><FONT COLOR="#000000">)</FONT>
Harrison,Greta U.9428 Madison Place
Leiberman,Emma L.9428 Maple Blvd
NameHome_Street
ORDER BY +Home_Street
Leiberman,Emma L.9428 Maple Blvd
Harrison,Greta U.9428 Madison Place
Vitaliy Serdtsev · Oct 18, 2017 go to post

Methods %FileIndices and %SaveIndices marked as [Internal].

Functional of %BuildIndices more than enough.

Vitaliy Serdtsev · Oct 18, 2017 go to post

SQLCODE and %msg are closely related.

Instead of <FONT COLOR="#0000ff">$$$SQLError</FONT>, you can use <FONT COLOR="#0000ff">$$$SQLCode</FONT>.

Vitaliy Serdtsev · Nov 14, 2017 go to post
  1. Asynchronous uploading only one file
    Class upload.fileOne Extends %ZEN.Component.page
    {
    

    </FONT><FONT COLOR="#000080">Parameter </FONT><FONT COLOR="#000000">DOMAIN = </FONT><FONT COLOR="#800080">"DC"</FONT><FONT COLOR="#000000">;

    </FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Style {   <</FONT><FONT COLOR="#000080">style </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"text/css"</FONT><FONT COLOR="#000000">>   </</FONT><FONT COLOR="#000080">style</FONT><FONT COLOR="#000000">> }

    </FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">] { <</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#800000">title</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Upload file using XMLHttpRequest" </FONT><FONT COLOR="#800000">labelPosition</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"left"</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">hgroup </FONT><FONT COLOR="#800000">cellVAlign</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"bottom"</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">fileUpload </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Select the file" </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileToUpload" </FONT><FONT COLOR="#800000">onchange</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.fileSelected()"</FONT><FONT COLOR="#000000">/>     <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Upload" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.uploadFile();"</FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">hgroup</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">label </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileType" </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Type: "</FONT><FONT COLOR="#000000">/>   <</FONT><FONT COLOR="#000080">label </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileName" </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Name: "</FONT><FONT COLOR="#000000">/>   <</FONT><FONT COLOR="#000080">label </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileSize" </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Size: "</FONT><FONT COLOR="#000000">/>   <</FONT><FONT COLOR="#000080">html</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">div </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"progressNumber"</FONT><FONT COLOR="#000000">>%</</FONT><FONT COLOR="#000080">div</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">progress </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"progressValue" </FONT><FONT COLOR="#800000">value</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"0" </FONT><FONT COLOR="#800000">max</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"100.0"</FONT><FONT COLOR="#000000">></</FONT><FONT COLOR="#000080">progress</FONT><FONT COLOR="#000000">>   </</FONT><FONT COLOR="#000080">html</FONT><FONT COLOR="#000000">> </</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">> }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadFile() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">fd </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">new </FONT><FONT COLOR="#000000">FormData();   fd.append(</FONT><FONT COLOR="#800000">'fUpload'</FONT><FONT COLOR="#000000">, zen(</FONT><FONT COLOR="#800000">'fileToUpload'</FONT><FONT COLOR="#000000">).findElement(</FONT><FONT COLOR="#800000">'control'</FONT><FONT COLOR="#000000">).files[</FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">]);   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">xhr </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">new </FONT><FONT COLOR="#000000">XMLHttpRequest();   xhr.upload.addEventListener(</FONT><FONT COLOR="#800000">'progress'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.uploadProgress, false);   xhr.addEventListener(</FONT><FONT COLOR="#800000">'load'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.uploadComplete, false);   xhr.addEventListener(</FONT><FONT COLOR="#800000">'error'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.uploadFailed, false);   xhr.addEventListener(</FONT><FONT COLOR="#800000">'abort'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.uploadCanceled, false);   xhr.open(</FONT><FONT COLOR="#800000">'POST'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">'upload.fileOne.cls'</FONT><FONT COLOR="#000000">);   xhr.send(fd); }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadProgress(</FONT><FONT COLOR="#ff00ff">evt</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(evt.lengthComputable) {     </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">percentComplete </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">Math.round(evt.loaded </FONT><FONT COLOR="#000080">* 100 / </FONT><FONT COLOR="#000000">evt.total);

        document.getElementById(</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000000">).innerHTML </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">percentComplete.toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#800000">'%'</FONT><FONT COLOR="#000000">;     document.getElementById(</FONT><FONT COLOR="#800000">'progressValue'</FONT><FONT COLOR="#000000">).value </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">percentComplete;   }   </FONT><FONT COLOR="#008000">else </FONT><FONT COLOR="#000000">{     document.getElementById(</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000000">).innerHTML </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'Cannot compute'</FONT><FONT COLOR="#000000">);   } }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadComplete(</FONT><FONT COLOR="#ff00ff">evt</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   zenAlert($$$Text(</FONT><FONT COLOR="#800000">'The upload is complete.'</FONT><FONT COLOR="#000000">)); }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadFailed(</FONT><FONT COLOR="#ff00ff">evt</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   zenAlert($$$Text(</FONT><FONT COLOR="#800000">'An error occurred when trying to upload the file.'</FONT><FONT COLOR="#000000">)); }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadCanceled(</FONT><FONT COLOR="#ff00ff">evt</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   zenAlert($$$Text(</FONT><FONT COLOR="#800000">'The upload was canceled by the user or the browser dropped the connection.'</FONT><FONT COLOR="#000000">)); }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">fileSelected() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">file </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'fileToUpload'</FONT><FONT COLOR="#000000">).findElement(</FONT><FONT COLOR="#800000">'control'</FONT><FONT COLOR="#000000">).files[</FONT><FONT COLOR="#000080">0</FONT><FONT COLOR="#000000">];   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(file) {

        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">fileSize </FONT><FONT COLOR="#000080">= 0</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(file.size </FONT><FONT COLOR="#000080">> 1024  1024</FONT><FONT COLOR="#000000">)        fileSize </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">(Math.round(file.size </FONT><FONT COLOR="#000080"> 100 / </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">1024  1024</FONT><FONT COLOR="#000000">)) </FONT><FONT COLOR="#000080">/ 100</FONT><FONT COLOR="#000000">).toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'MB'</FONT><FONT COLOR="#000000">);     </FONT><FONT COLOR="#008000">else        </FONT><FONT COLOR="#000000">fileSize </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">(Math.round(file.size </FONT><FONT COLOR="#000080"> 100 / 1024</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">/ 100</FONT><FONT COLOR="#000000">).toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'KB'</FONT><FONT COLOR="#000000">);

        zenSetProp(</FONT><FONT COLOR="#800000">'fileType'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">'value'</FONT><FONT COLOR="#000000">,file.type);     zenSetProp(</FONT><FONT COLOR="#800000">'fileName'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">'value'</FONT><FONT COLOR="#000000">,file.name);     zenSetProp(</FONT><FONT COLOR="#800000">'fileSize'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">'value'</FONT><FONT COLOR="#000000">,fileSize);         } }

    </FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">%OnPreHTTP() </FONT><FONT COLOR="#000080">As %Boolean </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">ServerOnly </FONT><FONT COLOR="#000000">= 1 ] {   </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">%request </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%CSP.Request   </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">stream </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%CSP.BinaryStream</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">%request</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">GetMimeData</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"fUpload"</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#0000ff">if $IsObject</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">stream</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{          </FONT><FONT COLOR="#008000">#; here you do with the received file useful work          /*     set ^tmp("filename")=stream.FileName     set ^tmp("filesize")=stream.Size     */          </FONT><FONT COLOR="#0000ff">quit $$$NO   </FONT><FONT COLOR="#800080">}   </FONT><FONT COLOR="#0000ff">quit $$$YES </FONT><FONT COLOR="#000000">}

    }</FONT>

  2. Asynchronous uploading immediately of several files
    <FONT COLOR="#000080">Class upload.fileMany Extends %ZEN.Component.page
    </FONT><FONT COLOR="#000000">{
    

    </FONT><FONT COLOR="#000080">Parameter </FONT><FONT COLOR="#000000">DOMAIN = </FONT><FONT COLOR="#800080">"DC"</FONT><FONT COLOR="#000000">;

    </FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Style { <</FONT><FONT COLOR="#000080">style </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"text/css"</FONT><FONT COLOR="#000000">>   </FONT><FONT COLOR="#800000">.</FONT><FONT COLOR="#000080">ok </FONT><FONT COLOR="#800000">{     </FONT><FONT COLOR="#000080">color</FONT><FONT COLOR="#800000">:</FONT><FONT COLOR="#000080">green</FONT><FONT COLOR="#800000">;   }

      </FONT><FONT COLOR="#000000">#dropZone </FONT><FONT COLOR="#800000">{     </FONT><FONT COLOR="#000080">width</FONT><FONT COLOR="#800000">: 360px;     </FONT><FONT COLOR="#000080">height</FONT><FONT COLOR="#800000">: 125px;     </FONT><FONT COLOR="#000080">border</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">dashed </FONT><FONT COLOR="#800000">2px #ccc;     </FONT><FONT COLOR="#000080">background-color</FONT><FONT COLOR="#800000">: #fefefe;     </FONT><FONT COLOR="#000080">color</FONT><FONT COLOR="#800000">: #ccc;     </FONT><FONT COLOR="#000080">text-align</FONT><FONT COLOR="#800000">: </FONT><FONT COLOR="#000080">center</FONT><FONT COLOR="#800000">;     </FONT><FONT COLOR="#000080">padding</FONT><FONT COLOR="#800000">: 125px 0 0 0;   }

    </FONT><FONT COLOR="#000000"></</FONT><FONT COLOR="#000080">style</FONT><FONT COLOR="#000000">> }

    </FONT><FONT COLOR="#000080">XData </FONT><FONT COLOR="#000000">Contents [ </FONT><FONT COLOR="#000080">XMLNamespace </FONT><FONT COLOR="#000000">= </FONT><FONT COLOR="#800080">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#000000">] { <</FONT><FONT COLOR="#000080">page </FONT><FONT COLOR="#800000">xmlns</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"http://www.intersystems.com/zen" </FONT><FONT COLOR="#800000">title</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Upload immediately multiple files using XMLHttpRequest"</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">html </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"dropZone"</FONT><FONT COLOR="#000000">>Drag files here or click below</</FONT><FONT COLOR="#000080">html</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">hgroup </FONT><FONT COLOR="#800000">cellVAlign</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"bottom"</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">html </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"selectFiles" </FONT><FONT COLOR="#800000">label</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Choose the files"</FONT><FONT COLOR="#000000">>       <</FONT><FONT COLOR="#000080">input </FONT><FONT COLOR="#800000">type</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"file" </FONT><FONT COLOR="#800000">class</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileUpload" </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"fileToUpload" </FONT><FONT COLOR="#800000">onchange</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.fileSelected(document.getElementById('fileToUpload').files)" </FONT><FONT COLOR="#800000">multiple</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"multiple" </FONT><FONT COLOR="#000000">/>     </</FONT><FONT COLOR="#000080">html</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Clear" </FONT><FONT COLOR="#800000">title</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Clear the queue" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.clearList();"</FONT><FONT COLOR="#000000">/>     <</FONT><FONT COLOR="#000080">spacer </FONT><FONT COLOR="#800000">width</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"10"</FONT><FONT COLOR="#000000">/>     <</FONT><FONT COLOR="#000080">button </FONT><FONT COLOR="#800000">caption</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Upload" </FONT><FONT COLOR="#800000">title</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Upload files to the server" </FONT><FONT COLOR="#800000">onclick</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"zenPage.uploadFile();"</FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">hgroup</FONT><FONT COLOR="#000000">>   <</FONT><FONT COLOR="#000080">fieldSet </FONT><FONT COLOR="#800000">legend</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Files waiting to upload"</FONT><FONT COLOR="#000000">>     <</FONT><FONT COLOR="#000080">html </FONT><FONT COLOR="#800000">id</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"holder"</FONT><FONT COLOR="#000000">/>   </</FONT><FONT COLOR="#000080">fieldSet</FONT><FONT COLOR="#000000">> </</FONT><FONT COLOR="#000080">page</FONT><FONT COLOR="#000000">> }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">clearList() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   fileQueue</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">[];   zen(</FONT><FONT COLOR="#800000">'holder'</FONT><FONT COLOR="#000000">).getEnclosingDiv().innerHTML</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">''</FONT><FONT COLOR="#000000">;   zen(</FONT><FONT COLOR="#800000">'selectFiles'</FONT><FONT COLOR="#000000">).refreshContents(); }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">fileSelected(</FONT><FONT COLOR="#ff00ff">files</FONT><FONT COLOR="#000000">) [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">holder </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'holder'</FONT><FONT COLOR="#000000">).getEnclosingDiv();   </FONT><FONT COLOR="#008000">for </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">var </FONT><FONT COLOR="#000000">i </FONT><FONT COLOR="#000080">= 0</FONT><FONT COLOR="#000000">; i </FONT><FONT COLOR="#000080">< </FONT><FONT COLOR="#000000">files.length; i</FONT><FONT COLOR="#000080">++</FONT><FONT COLOR="#000000">) {        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">file </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">files[i];

        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">fileSize </FONT><FONT COLOR="#000080">= 0</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(file.size </FONT><FONT COLOR="#000080">> 1024  1024</FONT><FONT COLOR="#000000">)       fileSize </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">(Math.round(file.size </FONT><FONT COLOR="#000080"> 100 / </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">1024  1024</FONT><FONT COLOR="#000000">)) </FONT><FONT COLOR="#000080">/ 100</FONT><FONT COLOR="#000000">).toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'MB'</FONT><FONT COLOR="#000000">);     </FONT><FONT COLOR="#008000">else       </FONT><FONT COLOR="#000000">fileSize </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">(Math.round(file.size </FONT><FONT COLOR="#000080"> 100 / 1024</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">/ 100</FONT><FONT COLOR="#000000">).toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'KB'</FONT><FONT COLOR="#000000">);        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">divInfo </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">document.createElement(</FONT><FONT COLOR="#800000">'div'</FONT><FONT COLOR="#000000">);     divInfo.innerHTML</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">file.name</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#800000">' ('</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">file.type</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#800000">') - '</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">fileSize;     holder.appendChild(divInfo);

        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">divProgN </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">document.createElement(</FONT><FONT COLOR="#800000">'div'</FONT><FONT COLOR="#000000">);     divProgN.id</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i;     divProgN.innerHTML</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'%'</FONT><FONT COLOR="#000000">;     holder.appendChild(divProgN);

        </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">prog </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">document.createElement(</FONT><FONT COLOR="#800000">'progress'</FONT><FONT COLOR="#000000">);     prog.id</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'progressValue'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i;     prog.max</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'100.0'</FONT><FONT COLOR="#000000">;     prog.value</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'0'</FONT><FONT COLOR="#000000">;     holder.appendChild(prog);

        fileQueue.push({i:i,file:file});   } }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">uploadFile() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">while </FONT><FONT COLOR="#000000">(fileQueue.length </FONT><FONT COLOR="#000080">> 0</FONT><FONT COLOR="#000000">) {     </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">item</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">fileQueue.pop();     uploadFile(item.file,item.i);   } }

    </FONT><FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">onloadHandler() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ] {   </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#000080">typeof </FONT><FONT COLOR="#000000">FileReader </FONT><FONT COLOR="#000080">== </FONT><FONT COLOR="#800000">"undefined"</FONT><FONT COLOR="#000000">) zenAlert($$$Text(</FONT><FONT COLOR="#800000">'Sorry, your browser does not support File API, so this demo will not work correctly'</FONT><FONT COLOR="#000000">));   fileQueue </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">new </FONT><FONT COLOR="#000000">Array();

      uploadFile </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#008080">function </FONT><FONT COLOR="#000000">(file, i) {     </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">xhr </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">new </FONT><FONT COLOR="#000000">XMLHttpRequest(), upload </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">xhr.upload, fd </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">new </FONT><FONT COLOR="#000000">FormData();          fd.append(</FONT><FONT COLOR="#800000">'fUpload'</FONT><FONT COLOR="#000000">, file);

        upload.addEventListener(</FONT><FONT COLOR="#800000">'progress'</FONT><FONT COLOR="#000000">,     </FONT><FONT COLOR="#008080">function </FONT><FONT COLOR="#000000">(evt) {       </FONT><FONT COLOR="#008000">if </FONT><FONT COLOR="#000000">(evt.lengthComputable) {         </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">percentComplete </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">Math.round(evt.loaded </FONT><FONT COLOR="#000080">* 100 / </FONT><FONT COLOR="#000000">evt.total);

            document.getElementById(</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i).innerHTML </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">percentComplete.toString() </FONT><FONT COLOR="#000080">+ </FONT><FONT COLOR="#800000">'%'</FONT><FONT COLOR="#000000">;         document.getElementById(</FONT><FONT COLOR="#800000">'progressValue'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i).value </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">percentComplete;                }       </FONT><FONT COLOR="#008000">else </FONT><FONT COLOR="#000000">{         document.getElementById(</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i).innerHTML </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">$$$Text(</FONT><FONT COLOR="#800000">'Cannot compute'</FONT><FONT COLOR="#000000">);       }            }, false);     upload.addEventListener(</FONT><FONT COLOR="#800000">'load'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#008080">function </FONT><FONT COLOR="#000000">(ev) {       </FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">c</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">document.getElementById(</FONT><FONT COLOR="#800000">'progressNumber'</FONT><FONT COLOR="#000080">+</FONT><FONT COLOR="#000000">i);       c.className</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'ok'</FONT><FONT COLOR="#000000">;       c.innerHTML</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'OK'</FONT><FONT COLOR="#000000">;     }, false);     upload.addEventListener(</FONT><FONT COLOR="#800000">'error'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#008080">function </FONT><FONT COLOR="#000000">(ev) {zenAlert($$$Text(</FONT><FONT COLOR="#800000">'An error occurred when trying to upload the file.'</FONT><FONT COLOR="#000000">));}, false);     upload.addEventListener(</FONT><FONT COLOR="#800000">'abort'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#008080">function </FONT><FONT COLOR="#000000">(ev) {zenAlert($$$Text(</FONT><FONT COLOR="#800000">'The upload was canceled by the user or the browser dropped the connection.'</FONT><FONT COLOR="#000000">));}, false);     xhr.open(</FONT><FONT COLOR="#800000">'POST'</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">'upload.fileMany.cls'</FONT><FONT COLOR="#000000">);     xhr.setRequestHeader(</FONT><FONT COLOR="#800000">'Cache-Control'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">'no-cache'</FONT><FONT COLOR="#000000">);     xhr.setRequestHeader(</FONT><FONT COLOR="#800000">'X-Requested-With'</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">'XMLHttpRequest'</FONT><FONT COLOR="#000000">);     xhr.send(fd);   }      dropZone</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'dropZone'</FONT><FONT COLOR="#000000">).getEnclosingDiv();   dropZone.addEventListener(</FONT><FONT COLOR="#800000">'dragenter'</FONT><FONT COLOR="#000000">,  </FONT><FONT COLOR="#008080">function</FONT><FONT COLOR="#000000">(ev){     ev.stopPropagation();     ev.preventDefault();   }, false);   dropZone.addEventListener(</FONT><FONT COLOR="#800000">'dragleave'</FONT><FONT COLOR="#000000">,  </FONT><FONT COLOR="#008080">function</FONT><FONT COLOR="#000000">(ev){     ev.stopPropagation();     ev.preventDefault();     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'backgroundColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#FEFEFE'</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'borderColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#CCC'</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'color'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#CCC'</FONT><FONT COLOR="#000000">;   }, false);   dropZone.addEventListener(</FONT><FONT COLOR="#800000">'dragover'</FONT><FONT COLOR="#000000">,  </FONT><FONT COLOR="#008080">function</FONT><FONT COLOR="#000000">(ev){     ev.stopPropagation();     ev.preventDefault();     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'backgroundColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#F0FCF0'</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'borderColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#3DD13F'</FONT><FONT COLOR="#000000">;     </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'color'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#3DD13F'</FONT><FONT COLOR="#000000">;   }, false);   dropZone.addEventListener(</FONT><FONT COLOR="#800000">'drop'</FONT><FONT COLOR="#000000">,  </FONT><FONT COLOR="#008080">function</FONT><FONT COLOR="#000000">(ev){   ev.stopPropagation();   ev.preventDefault();   </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'backgroundColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#FEFEFE'</FONT><FONT COLOR="#000000">;   </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'borderColor'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#CCC'</FONT><FONT COLOR="#000000">;   </FONT><FONT COLOR="#800000">this</FONT><FONT COLOR="#000000">.style[</FONT><FONT COLOR="#800000">'color'</FONT><FONT COLOR="#000000">] </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#800000">'#CCC'</FONT><FONT COLOR="#000000">;   zenPage.fileSelected(ev.dataTransfer.files);   }, false); }

    </FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">%OnPreHTTP() </FONT><FONT COLOR="#000080">As %Boolean </FONT><FONT COLOR="#000000">[ </FONT><FONT COLOR="#000080">ServerOnly </FONT><FONT COLOR="#000000">= 1 ] {   </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">%request </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%CSP.Request   </FONT><FONT COLOR="#0000ff">#dim </FONT><FONT COLOR="#800000">stream </FONT><FONT COLOR="#0000ff">As </FONT><FONT COLOR="#008080">%CSP.BinaryStream</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#800000">%request</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">GetMimeData</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">"fUpload"</FONT><FONT COLOR="#000000">)   </FONT><FONT COLOR="#0000ff">if $IsObject</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">stream</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#800080">{          </FONT><FONT COLOR="#008000">#; here you do with the received file useful work          /*     set ^tmp("filename")=stream.FileName     set ^tmp("filesize")=stream.Size     */          </FONT><FONT COLOR="#0000ff">quit $$$NO   </FONT><FONT COLOR="#800080">}   </FONT><FONT COLOR="#0000ff">quit $$$YES </FONT><FONT COLOR="#000000">}

    }</FONT>

Of course you can do the same on CSP.