php - How to check File integrity -
i'm developing app needs download, every minutes, files.
using php, list files , java list , check file if present or not. once downloaded it, need check integrity because after download, files corrupted.
try{ string path = ... url url = new url(path); urlconnection conn = url.openconnection(); conn.setdooutput(true); conn.setreadtimeout(30000); = conn.getinputstream(); readablebytechannel rbc = channels.newchannel(is); fileoutputstream fos = null; fos = new fileoutputstream(local); fos.getchannel().transferfrom(rbc, 0, 1 << 24); fos.close(); rbc.close(); } catch (filenotfoundexception e) { if(new file(local).exists()) new file(local).delete(); return false; } catch (ioexception e) { if(new file(local).exists()) new file(local).delete(); return false; } catch (ioexception e) { if(new file(local).exists()) new file(local).delete(); return false; } return false;
what can use in php , java check file integrity?
maintain checksum list on server, download file, generate checksum of downloaded file , check if same 1 on server. if is, file fine.
Comments
Post a Comment