1 package transactions; 2 3 import dinamica.*; 4 import java.io.*; 5 6 13 public class SaveImage extends GenericTransaction 14 { 15 16 19 public int service(Recordset inputParams) throws Throwable 20 { 21 int rc = super.service(inputParams); 22 23 String path = (String )inputParams.getValue("file"); 25 File f = new File(path); 26 Integer size = new Integer ((int)f.length()); 27 inputParams.setValue("image_size", size); 28 29 String fileName = (String )inputParams.getValue("file.filename"); 31 fileName = fileName.substring(fileName.lastIndexOf(File.separator)+1); 32 inputParams.setValue("file.filename", fileName); 33 34 String sql = getResource("query.sql"); 36 sql = getSQL(sql, inputParams); 37 38 Db db = getDb(); 40 db.saveBlob(sql, path); 41 42 return rc; 43 44 } 45 46 } 47 | Popular Tags |