您好,我在ASP.NET中有一个网页,其中显示一个表单,其中一方的图像提取的信息将是另一方的形式和图像,用Java填充数据库,但我需要做什么1000是插入图像和这些图像的路线是在本地路径,真的不知道如何,我正在检查一些教程,但所有做Blob.Yo我只是想要你在查询时使它看起来和形式跨图像。 这是我用Java填充数据库的代码。
我实际上有这个
public class ImagenesBD {
public static void main(String[] args) throws FileNotFoundException, IOException {
// TODO code application logic here
String ruta = "C:\\Users\\Usuario\\Desktop\\Carpeta_imagenes";
File carpeta = new File(ruta);
if (carpeta.exists()){
System.out.println("La carpeta " + ruta + " ya existe");
}else{
System.out.println("La carpeta " + ruta + " se ha creado");
carpeta.mkdir();
}
File imagen = new File ("C:\\Users\\Usuario\\Desktop\\descarga.jpg");
if (imagen.exists()){
FileReader fr = new FileReader (imagen);
BufferedReader br = new BufferedReader(fr);
System.out.println("se ha leido la imagen");
System.out.println(imagen);
}else{
System.out.println("la imagen no existe");
}
String origen = "C:\\Users\\Usuario\\Desktop\\descarga.jpg";
String destino = "C:\\Users\\Usuario\\Desktop\\Carpeta_imagenes";
for (int i = 0; i < 10; i++) {
String cadena = destino+"\\"+"descarga-"+i+".jpg";
System.out.println(cadena);
File copia = new File(cadena);
Files.copy(imagen.toPath(), copia.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
}
虽然文件夹的位置应该与程序的执行有关