473,441 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

General use of java.io.File

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
6 2667
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
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
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
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Lem | last post by:
I get the error Exception in thread "main" java.lang.NoClassDefFoundError when I type java app2 in the command prompt. I've tried moving to the jre directory and typed java c:\app2\app2, but it...
7
by: Chris | last post by:
Here's the situation: I work at a scientific institution and I have a portable electronic device which is used to take measurements. The device produces a very small amount of numerical data,...
1
by: Zandy Marantal | last post by:
Hello everyone, I'm having trouble using Xerces2(2.4, 2.5) when validating against an XML schema if a general entity reference is defined within the XML file. The error I'm getting is this:...
2
by: Alex | last post by:
Hello I am interested learn more about .NET but am uncertain of exactly what niche it fills in the world of programming. (The more I read the more I am confused). What I am looking for is the...
6
by: Alex | last post by:
Hello I am intersting in developing and my background is VBA used in Excel and a brief intro to Java. I am interested in learning beyond VB and feel that C++ would be a very good language to...
2
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
5
by: r035198x | last post by:
Setting up. Getting started To get started with java, one must download and install a version of Sun's JDK (Java Development Kit). The newest release at the time of writting this article is...
29
by: Dexter | last post by:
This Java based utility may be invoked from Java code to parse mathematical expressions. It is useful for programmers developing calculators, graphing utilities or other math related programs. ...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.