gracias
Código PHP:
package clases;
import java.beans.*;
import java.util.*;
import java.sql.*;
import java.io.*;
import java.text.*;
import database.*;
public class busca_fotos extends Object implements java.io.Serializable {
private static final String PROP_SAMPLE_PROPERTY = "SampleProperty";
private String sampleProperty;
private boolean Existe;
private String Error;
private String ruta;
private PropertyChangeSupport propertySupport;
private static String directorio_foto = "d:\\";
public busca_fotos() {
propertySupport = new PropertyChangeSupport( this );
}
public void Procesa(String rut){
try {
Connection conn = db_conectaoracle.getInstance().getConnection();
String sql = "select * from fotos where rut = "+ rut;
PreparedStatement ps = conn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
byte[] bits;
if(!rs.next()){
Existe=false;
}
else{
bits = rs.getBytes("foto");
java.io.FileOutputStream fw = new java.io.FileOutputStream(directorio_foto + rut + ".jpg");
fw.write(bits);
fw.close();
ruta= directorio_foto + rut + ".jpg";
Existe=true;
}
conn.close();
rs.close();
return;
} catch( Exception e ) {
Error=e.getMessage();
e.printStackTrace();
}
}
public boolean getResultado() {
return Existe;
}
public String getError() {
return Error;
}
public String getRuta(){
return ruta;
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertySupport.addPropertyChangeListener(listener);
}
public void removePropertyChangeListener(PropertyChangeListener listener) {
propertySupport.removePropertyChangeListener(listener);
}
}