|
| ||||||||||
| Tags: image, jsp, refresh, upload |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Refresh after upload an image in jsp
|
|
#2
| ||||
| ||||
| Re: Refresh after upload an image in jsp
Hello, if you make use of the servlet then you can solve your problem by simply making use of the code below: Code: DataOutput Out = new DataOutputStream (res.getOutputStream ());
res.setContentType ( "image / jpeg");
String img = request.getParameter ( "imageName");
File filename = null;
FileInputStream in = null;
String filenamePath = img.replace ("/", "\ \");
filename = new File (filenamePath);
if (File.Exists ())
return;
in = new FileInputStream (filename);
res.setContentLength ((int) filename.length ());
byte value [] = new byte [4096];
int number;
while ((number = in.read (value))! = -1)
{
Out.Write (value, 0, number);
}
in.close (); |
|
#3
| ||||
| ||||
| Re: Refresh after upload an image in jsp
Hello, when I was creating program for refreshing the code I have make use of the code below: Code: while (resultSet.next())
{
InputStream IStr =resultSet.getBinaryStream(2);
int c=0;
byte[] arr = new byte[4096];
int size=0;
res.reset();
res.setContentType("image/jpeg");
res.setHeader("Content-Disposition","filename=logo.jpg");
while ((c = IStr.read(arr)) != -1)
{
res.getOutputStream().write(arr,0,c);
}
System.out.println("Blob retrieved");
} |
|
#4
| ||||
| ||||
| Re: Refresh after upload an image in jsp
Hello, I am not able to get your problem properly. If you provide me in details about your problem then I can able to solve it. I want the details below:
|
|
#5
| ||||
| ||||
| Re: Refresh after upload an image in jsp
Hello, I think you must need to make use of the code below for getting your refresh of page after uploading an image in jsp: Code: <% @ Page import = "java.sql .*;"%>
<%
Connection con = null;
RequestDispatcher requestD;
try
{
pass String = (String) session.getAttribute ( "pass");
String lgin = "*****";
String reqpass = "******";
String url = "jdbc: mysql ://*******/ schneider_final";
Class.forName ( "com.mysql.jdbc.Driver"). NewInstance ();
con = DriverManager.getConnection (url, lgin, reqpass);
java.sql.Statement statement = con.createStatement ();
java.sql.ResultSet rs = statement.executeQuery ( "select * from users where pass =" + pass);
if (rs.first ())
{
String logo = rs.getString ( "logo");
if (logo! = null)
{
out.println ( "<img src=\""+request.getContextPath()+"/SrvShowLogo?imageName="+logo+"\">");
out.println ( "</ div>");
}
}
rs.close ();
statement.close ();
}
catch (Exception e)
{ }
%>
<br> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Refresh after upload an image in jsp" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using a Custom System Image, Refresh Windows 8 | Faraji | Tips & Tweaks | 1 | 24-08-2012 06:10 PM |
| How to refresh an image control in Silverlight | NAKKIRAN | Windows Software | 4 | 13-12-2010 06:11 PM |
| How to upload my profile image on Facebook | Daniel23 | Technology & Internet | 3 | 19-11-2009 11:24 PM |
| Html replace browse image upload | Brunoz | Software Development | 3 | 04-08-2009 03:24 PM |
| Upload image randomly with JavaScript Page | Zubeen | Software Development | 3 | 25-02-2009 01:54 PM |