Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Upload Image and save in database using jsp-servlet mvc

Have Programming Question? Ask it here!
 
 
 


dhanalakshmi
Upload Image and save in database using jsp-servlet mvc
0 Answer(s)      6 months and 29 days ago
Posted in : JSP-Servlet


Here is my code..
 In jsp ...

    <form name=frm method="post" action="Device">
    <table>
    <tr><TD ><B>Upload Image</B></TD>
    <td><input type="file" name="Image" size="20" value=""></TD>
    </tr>
    <tr>
    <td><input type="submit" height="30" width="62"> </td>
    </tr>
    </form>

<form name=frm method="post" action="Device">
<table>
<tr><TD ><B>Upload Image</B></TD>
<td><input type="file" name="Image" size="20" value=""></TD>
</tr>
<tr>
<td><input type="submit" height="30" width="62"> </td>
</tr>

In servlet...

    try
            {
                String strpath=request.getParameter("Image");
                String filepath=strpath.substring(strpath.lastIndexOf("\\")+1);
                File imgfile = new File(strpath);

                FileInputStream fin = new FileInputStream(imgfile);

            Connection connection=null;
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
            PreparedStatement pre = connection.prepareStatement("insert into uploadimage(image,image_name,image_length) values(?,?,?)");

            pre.setBinaryStream(1,fin,(int)imgfile.length());
            pre.setString(2,filepath);
            pre.setLong(3,imgfile.length());
            pre.executeUpdate();
            pre.close();
            String L_url1=response.encodeRedirectURL("Device.jsp");
            response.sendRedirect(L_url1);

            }
            catch(Exception ex){
            System.out.println("Exception in InsertImage : "+ex.getMessage());
            }
        }

but throws exception

    (The system cannot find the file specified)

How to rectify..

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Upload Image and save in database using jsp-servlet mvc
Upload Image and save in database using jsp-servlet mvc  Here is my code.. In jsp ... <form name=frm method="post" action="Device"> <table> <tr><TD ><B>Upload Image</B><
Upload Image and save in database using jsp-servlet mvc
Upload Image and save in database using jsp-servlet mvc  Here is my code.. In jsp ... <form name=frm method="post" action="Device">...; In servlet... try { String strpath=request.getParameter("Image
Advertisements
Image upload in mysql database using jsp servlet
Image upload in mysql database using jsp servlet  Hello, I need code to insert image in mysql database, I have seen the code which is already in your portal but it is not inserting image into database it save in the folder
save multiple records into database using jsp/servlet mvc
save multiple records into database using jsp/servlet mvc  hai, this is my jsp where i have enter multiple username and password and save it to database in single hit user.jsp <form action="UserServlet" method="post
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image and store that image in a database
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image and store that image in a database
Upload Image to Database through Servlet - JSP-Servlet
Upload Image to Database through Servlet  Hello, I make a application from where I upload the Image from local disk then store in DB.Before storing...:101249][ServletContext(id=29091418,name=Upload,context-path=/Upload)]: Servlet class
image upload and stored in database - JSP-Servlet
image upload and stored in database  How can i upload a image and store that image in a database  Hi Friend, Try the following code: 1)page.jsp: Display file upload form to the user UPLOAD
Image upload file - JSP-Servlet
Image upload file  I want a code for image upload jsp or servlet.  Hi friend, For image upload jsp or servlet visit to : http://www.roseindia.net/jsp/file_upload/employee_upload_profile_image.shtml http
how to save uploaded image in database using javascript
how to save uploaded image in database using javascript  Please can you tell me how to store uploaded image in database using java I'll use the upload code as extArray = new Array(".gif", ".jpg", ".png"); function LimitAttach
How i upload file and save that record in database using JSP?
How i upload file and save that record in database using JSP?  Hi All, I m the beginner in JSP and I want to upload the file and store that file... like Emp name, Emp id, city, address and one employee profile image(upload
upload to database - JSP-Servlet
upload to database  hai friends i have a query that is i have to upload a pdf file into database(sqlserver2000) using jsp. In roseindia some examples... into database whenever i want that uploaded pdf file i have to retrieve
Insert image from user using and save in database
Insert image from user using and save in database  when i am trying to upload a image from user and trying to save into oracle9i database...){e.printStackTrace();} } %> 3)For oracle database, use BLOB datatype for image
Upload Excel into Database Table Using SERVLET - JSP-Servlet
Upload Excel into Database Table Using SERVLET  Hi i hava sitution that upload .xls file into database table which has same coloumn names... in database table are NAME,ID,SAL. please help me to upload that excel using
retrive the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
How to upload files to server using JSP/Servlet?
How to upload files to server using JSP/Servlet?  How to upload files to server using JSP/Servlet
insert name city and upload image in database using mysql and jsp
insert name city and upload image in database using mysql and jsp   insert name city and upload image in database using mysql and jsp
Jsp using mvc - JSP-Servlet
Jsp using mvc  hi I have written using mvc2 architecture, i have written logic in java ,i want to print a message on the form stating the the values... closely together. Read MVC 2 Pattern in Struts2 in details and visit
upload image to database
upload image to database  i am try to upload image to MySql database using netbeans. when jsp execute it return no error. but also data does inserted in database. i am using blob datatype and preopared statement
How to insert and retreive an image in mysql database using spring mvc framework???
How to insert and retreive an image in mysql database using spring mvc... for handling all application requests --> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>
upload image using JSP Hibernate
upload image using JSP Hibernate  sir, I want to take image from user and save to database(MYSQL) using Hibernate and JSP Thanks in advance
passing the form values with image upload - JSP-Servlet
: 2. Enter value for field 2: 3. Upload file : and in your servlet you can...passing the form values with image upload  Hii . I want to get the solution for passing values with an image uploading form. I cant access
file upload and insert name into database - JSP-Servlet
file upload and insert name into database  Hi, I just joined as a fresher and was given task to upload a file and insert its name into database...  HIread for more information,http://www.roseindia.net/jsp/file_upload
Upload Exce Data into MySql Using Jsp and Servlet - JSP-Servlet
Upload Exce Data into MySql Using Jsp and Servlet  now i am doing... the following link: http://www.roseindia.net/jsp/upload-insert-csv.shtml Hope... into Mysql Database table so please give the coding to me, it's very urgent for me
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
how to upload an image from a jsp page to a mysql database table using jsp
how to upload an image from a jsp page to a mysql database table using jsp  how to upload an image from a jsp page to a mysql database table using jspstrong text
image upload&download using jsp - JSP-Servlet
image upload&download using jsp  can any one help in writing jsp for upload and download of images from database..  Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/fileupload.shtml http
retriving image from database - JSP-Servlet
retriving image from database  how to retrive image from mysql database by using servlet programming  Hi Friend, Please visit the following link: http://www.roseindia.net/servlets/retreiveimage.shtml Thanks
How display a image on servlet from file upload - JSP-Servlet
How display a image on servlet from file upload  Dear Sir, My issue is: How display a image on servlet from file upload I receive your answer today... upload page Employee Image
How display a Image on Servlet from file upload - JSP-Servlet
How display a Image on Servlet from file upload  Dear Sir, My requirement is I want to display a Image on Servlet from File Upload. But It not display on servlet,Its appear a downloaded form and downloaded on disk when click
How display a image on servlet from file upload - JSP-Servlet
How display a image on servlet from file upload   Dear Sir, My Question is: How display a image on servlet from file upload Your Answer: Hi... reason is inaccessible Thanks Sir, But Servlet page nothing display any type
edit database using jsp and servlet
edit database using jsp and servlet  I am creating a website using jsp and servlets that is used to view houses from a database. I want to be able... information from the database in the textboxes. Please help me to display
How display a Image on servlet from file upload - JSP-Servlet
How display a Image on servlet from file upload  Dear Sir, I were ask a question that How display the Image on servlet through file upload. Today I get your answer. But Sir, It code not display the image on servlet
Save profile and image to mysql database, and view the image in another jsp page
Save profile and image to mysql database, and view the image in another jsp page  Pls. need help in saving the profile info with the image in mysql database.. some basic code pls in jsp... thanks in advance
i want to save image on server folder. and i want to save URL of this folder and name of image in database
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. and i want to save URL of this folder and name of image in database.on click
upload and save the file
upload and save the file  upload and save a file from a computer to specific location of remote computer using jsp
How to save database data into excelsheet using hibernate
How to save database data into excelsheet using hibernate  How to save database data into excelsheet using hibernate
How to save run time created text-file on a disk using jsp/servlet?
How to save run time created text-file on a disk using jsp/servlet?  I have a JSP page with save button.In that I created the file(e.g a.txt) at run-time,when I click on the save button,it will ask where to save the file
upload images - JSP-Servlet
upload images  How to write the jsp code to upload images... to upload any file therefor it can also upload an image and can insert...://www.roseindia.net/jsp/upload-insert-csv.shtml Thanks
How to browse excel file and stored the contents into the database using jsp/servlet?
How to browse excel file and stored the contents into the database using jsp/servlet?  Hi.. I want to browse excel file and stored the file data into the My-sql database using jsp/servlet
how to store image upload path to mssql database
help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit...(); } }   Here is a jsp code that allow the user to upload a file and save
how to store image upload path to mssql database
help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit...(); } }   Here is a jsp code that allow the user to upload a file and save
how to store image upload path to mssql database
help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit...(); } }   Here is a jsp code that allow the user to upload a file and save
how to store image upload path to mssql database
help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit...(); } }   Here is a jsp code that allow the user to upload a file and save
File Upload in J2ee on solaris machine using sftp - JSP-Servlet
File Upload in J2ee on solaris machine using sftp  Hi, Currently we are using FTP to upload the file from our J2EE web application... the application in such a way that file upload can be done using SFTP on remote Solaris
image upload
image upload  Hello sir I want to upload image or any other type of file on website using jsp and servlet but the condition is that the file should... in oracle or my sql. kindly help me.   JSP Upload file and save file path
Upload the picture - JSP-Servlet
://www.roseindia.net/jsp/file_upload/employee_upload_profile_image.shtml Thanks RoseIndia...Upload the picture  Dear Sir, How to upload the picture in the database a webpage and i want to show that picture another page. what i
How to Insert image and data both together in database in JSP/Servlet ?
How to Insert image and data both together in database in JSP/Servlet ? ...;<TITLE>Display file upload form to the user</TITLE></HEAD> <... colspan="2" align="center"><B>UPLOAD THE FILE</B><center><
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
Upadate Database using updatable fields - JSP-Servlet
Upadate Database using updatable fields  Hi, Thanks for previous answers.They were of Great Help !!! I want to create a jsp in which data is pulled from database and displayed in the updatable fields.Means after user
 

 

 

DMCA.com