Applet won't delete temp files

D

Dustin

I have created a web site for my family that allows them to have online
photo albums. For this website, I created a Java Applet to aid in
uploading images to the photo albums. The user chooses images from
their computer to upload (the Applet is contained in a signed jar file
so that it can have access to the user's file system). Then they click
on a button to begin the upload. Each picture is scaled down to a
standard size before the upload takes place. The new scaled image is
stored as a java temp file on the user's hard disk and then uploaded to
the server via FTP. The problem I am haveing is this- When I run the
application from a JFrame, everything works fine and the temp files get
deleted. However, when I run it as an applet from the web, almost
everything works fine. The image gets scaled and the temp file gets
produced. That temp file is successfully copied to the server. But
then the temp files are never getting deleted! So it fills up the
user's hard drive with copies of the images they are uploading. Here
is a snippet of the basic idea of how I am doing this. The code is
obviously very incomplete. It is just to give you an idea of what is
going on.

**** CODE ****

File imgFile = new File("path/to/file.jpg");
imgFile = scaleDownImage(imgFile);
ftpClient.stor(new FileInputStream(imgFile.getAbsolutePath());
imfFile.delete();

**** END CODE ****


Thank you in advance for any help.
Dustin
 
D

Dustin

Hey, I figured out what was wrong and thought I would post what it was
in case anyone has this same problem. The FTP stor procedure required
an input stream which I created from the file. Then, in order to
delete the file, I needed to close the input stream, which I was not
doing. Simple answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top