Not sure if it will make much improvement in the ongoing discussion, but after 
reading 
Paul's proposed method I remembered about a page of mine. And yes, it was using 
precisely that method, but with  ctl.files.item(0).getAsBinary()  rather than  
ctl.files.item(0).getAsText('')   --where "ctl" is a pointer to the file input 
html object--  so it 
works with gzipped files as well as with plain-text files. That is a 
Firefox-only method, but it's 
easy to branch the action for other browsers to just read the input field (see 
example code at 
the bottom). If should be straightforward to include this in a check routine 
that will upload the 
file only upon the user's acceptance of the Jmol display, and do so straight 
from the input 
type=file control (which, as I said, I believe is the only allowed method for 
uploading files to 
the server).

I am intrigued by Rob's indication that jmolLoadInline fails with some browsers 
--could you 
provide specific details?  We should address that limitation.

I am seeing now that Chrome and Safari (Windows) have the same security 
limitation as 
Firefox on reading the value of input file, but cannot use the files.item() 
method which works 
for Firefox. More research needed :-(

---------

function displayModelJmol(ctl)
{       if ( ctl.files )                // for Firefox 3 security
        {       jmolLoadInline(ctl.files.item(0).getAsBinary())
        }
        else
        {       jmolScript('load "' + ctl.value + '";')
        }
}

<form>
<input type="file" name="model">
<input type="button" value="accept" onClick="displayModelJmol(this.form.model)">
<!-- it could also be called in onChange of the input control -->
</form>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to