Home Answers Viewqa JSP-Servlet Delete image from folder

 
 


Rajkumar
Delete image from folder
2 Answer(s)      4 years and 8 months ago
Posted in : JSP-Servlet

View Answers

September 23, 2008 at 5:58 PM


Hi firend,


Please specify the problem in details.

Thanks


September 23, 2008 at 7:21 PM


Using this concept you can delete image from ur server not from local copy.

DeleteServlet.java
==================
public class DeleteServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

ServletContext ctx = getServletContext();
String filename = "1.gif";
DeletePhoto dp = new DeletePhoto();
dp.deleteMyPhoto(ctx, filename);
}

}
--------------
DeletePhoto.java
=================
public class DeletePhoto {

public void deleteMyPhoto(ServletContext ctx, String photoname){

String path = ctx.getRealPath("photos")+ File.separator + photoname;
System.out.println(path);
new File(path).delete();
}
}

hope this help u

Thanks
Rajanikant









Related Pages:
Delete image from folder - JSP-Servlet
Delete image from folder  Hi Thanks Rajnikant to given me reply i am not storing my image in db just userid comming from db means my image name like : Pie(userid).png which alocated in my server folder when
Delete image from folder - JSP-Servlet
Delete image from folder  Dear All, i used some coding.... that image name based on user id and that image is going to on folder in server after some time its burden for server. so dear friends i want to delete that image
image save to folder in java
image save to folder in java  Hi, I am working with java. In my application i want to give facility to user to add and change image. I use open dialog box to select image, it will work properly i.e on button click open dialog
Full path of image to save it in a folder
Full path of image to save it in a folder  Sir ,I am trying to upload... to find that image path &upload it as well. I am just a beginner in jsp... in the local context of your project, then you may first create a folder under WEB
Jmagick write image to a specific folder
for resizing the images into which the image will be get from one location... to resize from c:\myDirectory\images and save the resized image to c:\myDirectory\newImages. When I compile my code it gets the image from c:\myDirectory\images
How to copy an jpeg image from one folder to other folder using jsp
How to copy an jpeg image from one folder to other folder using jsp  How to copy an image from one folder to another folder using jsp
How to copy an jpeg image from one folder to other folder using jsp
How to copy an jpeg image from one folder to other folder using jsp  hello, i am creating photo gallery where from admin side i allow admin to browse... be in my image folder...so,How to copy an jpeg image from one folder to other
i want to save image on server folder. and i want to save URL of this folder and name of image in database
of a link it retrieves the image data from server folder according to URL and File...i want to save image on server folder. and i want to save URL of this folder and name of image in database  hi i want to save image on server folder
How to access the image file from project folder itself while writing to pdf using itext?
How to access the image file from project folder itself while writing to pdf... to search for the image in the domain folder of the glassfish location.But i want it to pick it up from the project folder itself.Because later i deploy the project
DELETE
DELETE   I AM DOING IT IN MYSQL. DELETE FROM EMP WHERE SAL>(SELECT SAL FROM EMP WHERE ENAME='MILLAR') AND ENAME='ALLEN'; THIS IS GIVING...' for update in FROM clause ANY ONE PLEASE HELP ME. WITH REGARDS
delete
= conn.createStatement(); st.executeUpdate("DELETE FROM employee WHERE empid...delete  how delete only one row in the database using jsp.database...); String query = "select * from employee"; st = con.createStatement
Image name,image path into database and image into folder using jsp
Image name,image path into database and image into folder using jsp  How to insert image path and image name into oracle database and image into folder using jsp
image upload in webapp/upload folder
image upload in webapp/upload folder  sir i want to store upload image in my project directory WebApp/Upload_image/ pls send the jsp servlet code when i upload the image one error found "system cannot found the specified path
copy file from folder to folder - Java Beginners
copy file from folder to folder   my requirement is I need to copy xml files from one folder to another my source file contains the field filename wich contains the file to be copied. I want to copy the file from
Java- Save Image into project folder in web application
Java- Save Image into project folder in web application  I have a requirement of saving the image into project folder .. which is a web application... want to save the image..when I am trying to create empty folder and get
how to download a file from a folder??
how to download a file from a folder??  i can upload any kind of files to a folder, and only the path of the file is saved into the database, now how a client can download the file from my folder. pls provide me the jsp code
Zip Folder Using Java
Zipping a Folder       In this example we are going to create a zip folder and all files contained in this folder are zipped by using java. Here we will learn how to compress files
create a folder in jsp page
create a folder in jsp page  i want to create a folder in jsp page And it can be delete aslo
Image Album
Image Album  hi, i want to save image on server folder. and i want to save URL of this folder and name of image in database.on click of a link it retrieves the image data from server folder according to URL and File name stored
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
how can create pop() method in this program ,Or how can delete image in it when...;// these image that put in program must be in the same folder that saved the program...) JOptionPane.showMessageDialog(null," Album is Full you can not push the image ."); else
delete an item from database
delete an item from database  how to delete an item from the database using jsp
delete app from iphone
delete app from iphone  How to delete an existing app from itunes
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.   import java.io.File; import... srcFile, ZipOutputStream zip) throws Exception { File folder = new File
java - file delete - Java Beginners
java - file delete  I will try to delete file from particular folder... folder files is used three times (open and closed) in my project. In finally I will try to delete these files. But it doesn?t delete from this folder. My code
java - file delete - Java Beginners
java - file delete  I will try to delete file from particular folder... will try to delete these files. But it doesn?t delete from this folder. My code... following code to delete a file from the folder import java.io.File; public
Image is in same folder where the java file is located - Swing AWT
Image is in same folder where the java file is located  dear sir It is there in the same folder..means the photograph.jpg file is created in the same folder where my java file is present... wat I should do sir
Delete points from database
Delete points from database  I have a polygon on a web page...: mysqlquery("DELETE FROM polygon WHERE ID=".$GET['ID']."") or die(showsqlerrors(mysql_error())); I also used: mysqlquery("DELETE FROM points WHERE ID=".$GET['ID
How to flip image
How to flip image       In this section , you will see how to flip image. To reverse the image, an image is put into the folder where class is specified. The getDefaultToolkit
URL folder download to local
URL folder download to local  I have a requirement to download all the folders and files inside from a SVN link to my local directory. Can you help how it could be done
How to make a folder icon, make a folder icon, folder icon
How to make a folder icon       The folder is used in the computer, this example will teach you to design technique of the folder.  New File: Take a new file as your folder
Zipping folder - Java Beginners
to zip a user selected folder . this folder may contain any number of folder and sub folders. i saw an example in this site showing , how to zip a folder, i executed... solve this.. zipping folder and all of its files and sub folders. thanking
how to store image in folder and stored image path in mysql database using JSP
how to store image in folder and stored image path in mysql database using JSP  how to store image in folder and stored image path in mysql database using JSP
How to store user name,city,state,image path into database and image into folder using jsp
How to store user name,city,state,image path into database and image into folder using jsp  How to store user name,city,state,image path into database and image into folder using jsp
delete row from a table in hibernate
delete row from a table in hibernate  is there method to delete row in a table using hibernate like save(-) to insert row
Browse an image
Browse an image  hi................ i want to browse an image from the folder and display in form of my project..... can u tell me how to do... java.awt.event.*; public class UploadImage extends JFrame { Image img; JTextField
How can store image in server folder when deployed with a .war file?
How can store image in server folder when deployed with a .war file?  Hi all; When I am using application.getRealPath() , it return null when deployed with a .war file and when I use hard code it shows syntax error or path
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
Delete a row from database by id
Delete a row from database by id  I m creating a small application...) for "DELETE" AND "UPDATE". On clicking delete which is hyper link that particular row.... So anyone will tell me how to give hyper link to Delete and Update and delete
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
how to delete a jar from mobile
how to delete a jar from mobile  After auto updating a new version of jar from server. I want to delete the old jar from mobile and want to install the new jar which is present in server. Can u tell me the code how to do
image upload in java
select any image i want to store that selected image into specified folder...image upload in java  Hi, I am working with java. In my application i want to give facility to user to add and change image. I use open dialog box

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.