android downloading apk file from internet results in parsing error -


when try download file using following code , run apk file, results in "parsing error". clueless. appreciated.

try                   {                    url url  = new url("http://10.0.0.1/test.apk");                           urlconnection conexion = url.openconnection();                           conexion.connect();                          int lenghtoffile = conexion.getcontentlength();                          inputstream is=url.openstream();                          fileoutputstream fos=new fileoutputstream("/flash/test.apk");                         byte data[]=new byte[1024];                         int count=0;                         long total=0;                         int progress=0;                          while ((count=is.read(data)) != -1)                           {                               total += count;                               int progress_temp = (int)total*100/lenghtoffile;                               if(progress_temp%10 == 0 && progress != progress_temp){                                   progress = progress_temp;                                   log.v("apk download", "total = "+progress);                                   // log.v                              }                               fos.write(data, 0, count);                           }                            is.close();                           fos.close();                            log.v("apk download", "download done");                        }catch (exception e){} 

god bless! confused , looked file uploaded on webserver corrupt. if upload through filezilla it's getting corrupted , if use cpanel upload file, works great. thank god, able move forward in coding after spending hours problem. :)


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -