title: URL - FileNotFoundException for image file in Android
body: <p>I'm trying to get a image from particular URL but it throws<code>FileNotFoundException</code>. If I try to open the url from my browser, i can see the images. Please help. Below is my code. Thanks.</p>
  
  <pre><code>String fileURL = "http://sposter.smartag.my/images/KFC_Voucher.jpg";
  String FILENAME = "caldophilus.jpg";
  URL u = new URL(fileURL);
  HttpURLConnection c = (HttpURLConnection) u.openConnection();
  c.setRequestMethod("GET");
  c.setDoOutput(true);
  c.connect();
  File root = Environment.getExternalStorageDirectory();
  FileOutputStream f = new FileOutputStream(new File(root, FILENAME));
  InputStream x=c.getInputStream();
  int size=x.available();
  byte b[]= new byte[size];
  x.read(b);
  f.write(b);
  f.flush();
  f.close();
  </code></pre>