|
-
September 24th, 1999, 03:57 AM
#1
Applet for File Loading
I am using jdk1.3 ,
I have written a program which calls a file :=
the program looks like this
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;
public class testing extends Applet
{
String str;
String file;
public void init()
{
file = getParameter("FileName");
try
{
FileInputStream fileIn = new FileInputStream(file);
int inBytes = fileIn.available();
byte inBuf[] = new byte[inBytes];
int bytes = fileIn.read(inBuf,0,inBytes);
str = new String(inBuf,0,bytes,"Default");
}
catch(Exception e)
{
String err = e.toString();
System.out.println(err);
str = new String("");
}
}
public void paint(Graphics g)
{
g.drawString(str,0,50);
}
}
The html file is
<applet code ="testing.class" width=300 height=300>
<param name=FileName value="d:\sz\temp.txt">
</applet>
every thing works fine for console based application but the problem is ,if i load the file on the server
for ex WinNt server and reference the file with
<param name=FileName value="http://ntserver/Inetpub/wwwroot/sz/temp.txt">
it is not loaded.
Netscape writes the below in JavaConsole message
netscape.security.AppletSecurityException: security.checkread: Read of '\\Ntserver\InetPub\wwwroot\sz\temp.txt' not permitted
I jhave loaded all the required files on the server.
can any one please guide me the right way;
Thanks
sachin
-
September 26th, 1999, 09:12 AM
#2
Re: Applet for File Loading
Hi
Using an Applet you cannot access any system directory structure and any other computers directory structure by doing this you are violating the security policy.
I think i have got you correct.
If yes and you want me to give you more details on this please reply
Thanks
-
July 25th, 2000, 02:59 PM
#3
Re: Applet for File Loading
Yes please provide me the solution for downloading and uploading of ifles over the net through applets.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|