By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,275 Members | 947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,275 IT Pros & Developers. It's quick & easy.

General use of java.io.File

P: n/a
I'm writing this routine that calls the length() member of
java.io.File. Is this object generally available in most mainstream
browsers, or do some of them lock it down?
Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hello,

AFAIK, browsers would block Java File I/O by default.

However this question is more relevant in comp.lang.java

--
Elias
"Jamie" <He*********@hotmail.com> wrote in message
news:35**************************@posting.google.c om...
I'm writing this routine that calls the length() member of
java.io.File. Is this object generally available in most mainstream
browsers, or do some of them lock it down?

Jul 20 '05 #2

P: n/a
Hi,

Jamie wrote:
I'm writing this routine that calls the length() member of
java.io.File. Is this object generally available in most mainstream
browsers, or do some of them lock it down?


java objects can only be called from JavaScript in Mozilla browsers
(though I didn't test it thoroughfully in Netscape 7). In IE, you cannot
access these objects directly. If you need to access these objects from
JavaScript, you got to encapsulate them in an applet. It will be then
possible to call public methods and attributes of the applet from
JavaScript. This is LiveConnect, and works in IE as well as
Netscape/Mozilla.

See
<URL:
http://www.galasoft-lb.ch/myjavascript/consulting/LiveConnect102/index.html>

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #3

P: n/a
Hi,

lallous wrote:
Hello,

AFAIK, browsers would block Java File I/O by default.
In a default security environment, yes. But there are other cases.
However this question is more relevant in comp.lang.java

--
Elias


I think it's relevant here, because the question has to do with
LiveConnect, which is the technology allowing JavaScript and Java to
communicate.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #4

P: n/a
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in message news:<bs**********@rex.ip-plus.net>...
Hi,

Jamie wrote:
I'm writing this routine that calls the length() member of
java.io.File. Is this object generally available in most mainstream
browsers, or do some of them lock it down?


java objects can only be called from JavaScript in Mozilla browsers
(though I didn't test it thoroughfully in Netscape 7). In IE, you cannot
access these objects directly. If you need to access these objects from
JavaScript, you got to encapsulate them in an applet. It will be then
possible to call public methods and attributes of the applet from
JavaScript. This is LiveConnect, and works in IE as well as
Netscape/Mozilla.

See
<URL:
http://www.galasoft-lb.ch/myjavascript/consulting/LiveConnect102/index.html>


I'm not sure exactly what that is, but before I go on, I should
probably know if it is feasible: I just need to be able to know the
size of a file on the client computer. What I'm doing is writing a CGI
(binary) that (among other things) receives files from the client
browser. My problem here is blocking files over a certain size. I
don't know if I can do that reliably on the server (w/the CGI) before
the upload has started, but I'd like to be able to put this block on
the client-side. Is this feasible? Should I goto a Java solution?
Jul 20 '05 #5

P: n/a
Hi,

Jamie wrote:

I'm not sure exactly what that is, but before I go on, I should
probably know if it is feasible: I just need to be able to know the
size of a file on the client computer. What I'm doing is writing a CGI
(binary) that (among other things) receives files from the client
browser. My problem here is blocking files over a certain size. I
don't know if I can do that reliably on the server (w/the CGI) before
the upload has started, but I'd like to be able to put this block on
the client-side. Is this feasible? Should I goto a Java solution?


In a normal (client-side) security environment, it is not possible to do
that. You have strictly no access to the file, or its properties, which
is to be uploaded.

In relaxed security environments (for example locally or in a Intranet),
it is possible to use the ActiveX component FileSystemObject on IE, or
the java.io packages on Mozilla to do this kind of things. It's not
cross-browser compatible, and it needs, as I said, a lower security
setting. Would that be an option?

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #6

P: n/a
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in message news:<3f**********@news.bluewin.ch>...
Hi,

Jamie wrote:

I'm not sure exactly what that is, but before I go on, I should
probably know if it is feasible: I just need to be able to know the
size of a file on the client computer. What I'm doing is writing a CGI
(binary) that (among other things) receives files from the client
browser. My problem here is blocking files over a certain size. I
don't know if I can do that reliably on the server (w/the CGI) before
the upload has started, but I'd like to be able to put this block on
the client-side. Is this feasible? Should I goto a Java solution?


In a normal (client-side) security environment, it is not possible to do
that. You have strictly no access to the file, or its properties, which
is to be uploaded.

In relaxed security environments (for example locally or in a Intranet),
it is possible to use the ActiveX component FileSystemObject on IE, or
the java.io packages on Mozilla to do this kind of things. It's not
cross-browser compatible, and it needs, as I said, a lower security
setting. Would that be an option?


I don't know. It's going to be the customer's customers who would
be reducing the security on their browsers. I'll have to ask my
customer if he's willing to force his customers to do that. Otherwise
I'd have to look for a server-side solution. Thanks for your input
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.