I have a servlet which uploads file to server. Below is my code and is working file. Now, I want to check if the file uploading by the user is already exists. If so , I have to display a message to user "The file you are trying to upload already exists. Do you want to overwrite" with YES or NO actions.
How can I display this alert message from user.
Can anyone suggest me on this? [ October 30, 2007: Message edited by: Ben Souther ]
AJAX has no concept of files, and so can't be used for the upload.[/QB]
Why not? You can use ajax to upload files. do some googling you will find read made code.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
Originally posted by sudhir nim: Why not? You can use ajax to upload files. do some googling you will find read made code.
AJAX can send data to the server, but it can't upload files because JavaScript has no access to the client file system.
Senthil Kumar
Ranch Hand
Joined: Oct 14, 2007
Posts: 33
posted
0
Rohit, You can try setting a request atribute in the servlet once you find the file already exists in the location. 1.In the JSP write a scriplet for getting the attribute value and assign it to variable declared in the scriptlet. 2.Now declare a variable in the Javascript and assign scriplet variable's value to this script variable. 3.You have to write an ONLOAD event Handler. In that function,check the javascript variable and display the alert. I think this will work.