Image is partially downloading,

I cannot download the file in following url:

Only a part of the file is being downloaded.

Following is my code. Please let me know if I'm doing anything wrong.

URLConnection urlConn = new URL( "").openConnection(); InputStream is = urlConn.getInputStream(); FileOutputStream fos = new FileOutputStream( file.getPath() ); byte[] buffer = new byte[4096]; int len; while( ( len = buffer ) ) > 0 ) { fos.write( buffer, 0, len ); } fos.close();

-------------Problems Reply------------

I just tried this...

HttpClient client = HttpClientBuilder.create().build();
HttpGet get = new HttpGet("");

HttpResponse execution = client.execute(get);
HttpEntity entity = execution.getEntity();
FileOutputStream outputStream = new FileOutputStream("C:\\tmp\\imgout.jpg");

if (entity != null) {
InputStream inputStream = entity.getContent();
IOUtils.copy(inputStream, outputStream);


...and the output file contains the TEXT...

<META NAME="robots" CONTENT="noindex">
Sorry, your browser doesn't seem to support frames! <br>
Proceed to <A href=""></A> manually.

So probably nothing wrong with your code (I'd still use != -1 instead of > 0 though)! Maybe you need to set a request header or something...

Category:java Views:1 Time:2017-09-11

Related post

  • Partially download and serialize big file in C#? 2012-02-20

    As part of an upcoming project at my university, I need to write a client that downloads a media file from a server and writes it to the local disk. Since these files can be very large, I need to implement partial download and serialization in order

  • Access and Display Images/ Prompt File Downloads that are located outside the application folder 2009-06-22

    How to access and display the images that are located outside the application folder? Let's say I have a file directory that stores all the images and other file types, and this file directory is located on a different drive then my application folde

  • Download file using partial download (HTTP) 2009-11-25

    Is there a way to download huge and still growing file over HTTP using the partial-download feature? It seems that this code downloads file from scratch every time it executed: import urllib urllib.urlretrieve ("

  • Full width image carousel that can center selected image and partially show other images in gallery 2009-11-27

    I've looked for a plugin that will do this and the closest I could find was CarouselLite but it doesn't really do what I am trying to get. Most of other libraries I could find don't like 100% width or hide inactive images or don't center the active i

  • How to partially download a remote file with cURL? 2010-01-09

    Is it possible to partially download a remote file with cURL? Let's say, the actual filesize of the remote file is 1000 KB. How can I download only first 500 KB of it? --------------Solutions------------- You can also set the range header parameter w

  • ASP.NET 3.5 C# : Combine images in one download 2010-04-19

    I Would like to know if its possible to combine mulitple images in 1 download. On my homepage I'm showing 12 images which change depending on the country of the user. I notice this takes a lot of time to download for some users and i would like to kn

  • How to create partial download in twisted? 2010-07-25

    How do you create multiple HTTPDownloader instance with partial download asynchronously? and does it assemble the file automatically after all download is done? --------------Solutions------------- You must use Range HTTP header: Range. Request only

  • I want to display an image instead of downloading it (Image in database blob) 2010-11-03

    I want display an image instead of downloading it. I have image in my database table, column as BLOB. This snippet downloads the image, but I want to display it instead: $query = "SELECT * FROM upload"; $result = mysql_query($query); $row = mysql_fet

  • Serving files through controllers with partial download support 2010-11-13

    I need to serve files through grails, only users with permission have access, so I cant serve them with a static link to a container. The system is able to stream binary files to the client without problems,but now (for bandwidth performance issues o

  • How to detect when AJAX-loaded images are fully downloaded? 2010-11-18

    I'm working on a website where the homepage has a rotating banner. When the page is loaded, an AJAX request is performed to retrieve the rest of the banners (each of which has a 960-pixel wide image). I toyed with the idea of loading the page normall

  • How do you identify when an image is done downloading with jQuery? 2011-03-03

    I am using form input to change the source of an img tag on the fly. I want to put an ajax loader in place of the image until the image is done downloading, and then replace the loader with the new image. Anyone know how I can do this? --------------

  • Which is the best method to display thumbnail images on UIScrollview (downloaded from server) 2011-03-27

    I want to show a number of images (as thumbnails) on the UIScrollview (like the Photos app). All the images will be downloaded from the server. To display, as per my knowledge, there are few alternatives: 1) By creating UIImageviews and then add them

  • Resumable and partial download with PHP curl or similar? 2011-03-28

    Is is possible to resume downloading a partially downloaded file with curl or similar? I mean, let's say we have this big dbdump.sql file on a http or ftp server which is 1 GB in size; could I somehow tell this server please send from the file from b

  • Is there a LAMP stack all-in-one image available for download? 2011-06-11

    Is there a site that has a pre-configured all-in-one LAMP image ready to download and set up for local development, say using VirtualBox or similar? I want to dabble in some PHP (possibly Django) but for just local testing I'm looking to take the laz

  • how to use '~=' to return images that partially match an entered image name / text 2011-07-18

    Is possible to use this? (the code format is mixed html jQuery, but just for explanation.) <input id="input" type="text" value="" /> // the entered text: 'car' var text= $('#input').text(); // is taken by jquery... And than something like: (to

  • Get image size wihout downloading it in Python 2011-09-18

    How can I get dimensions of image without actually downloading it? Is it even possible? I have a list of urls of images and I want to assign width and size to it. I know there is a way of doing it locally (How to check dimensions of all images in a d

  • implementing progress dialog in which the no of images to be downloaded in more than 1 2011-10-28

    I want to show progress dialog at the time images are being downloaded from server. i am able to download the images and implement the progress dialog but my problem is that the progress dialog doesnot get dismissed and it only shows the last downloa

  • How do determine if an image is partially corrupt? C# 2012-01-16

    I have raw bytes for an image. I use the following to code to determine if the image is corrupt or not public bool IsValidGDIPlusImage(byte[] imageData) { try { using (var ms = new MemoryStream(imageData)) { using (var bmp = new Bitmap(ms)) { } } ret

  • Python/Mechanize: Preventing images from being downloaded/opened 2012-03-17

    When I open a page, I'm assuming all images are also downloaded with Mechanize. Is there a way for me to just retrieve the source code? If mechanize doesn't allow for this, is there an alternative that does?

  • Embedded images in email : "Download Incomplete" 2012-06-05

    Hi, Image in email (embedded) are not load and there is a "download incomplete" message. Standard ad email with image (Microsoft email too....). Everything is working on WiFi but not working on 3G. Problem occurs on : Hotmail account Gmail account (s

  • Photo partial downloads using windows 7 2012-05-01

    when i connected my camera to my old pc using XP a box appeared saying 'what do you want to do with windows' my preferred option was then :- copy pictures to a folder on my computer using microsoft scanner and camera wizard This allowed all the thumb

  • Trouble removing a partially downloaded file. 2012-10-22

    I'm using windows 7. I have downloaded a music file/song from a popular website which doesn't hold any viruses. My download was interrupted and the it has appeared as a partial download on my desktop. Every time I try to delete it i receive a pop up

  • Emails with image attachments some images are partially grayed out 2012-12-13

    Windows Live, images attached to email; some images are partially grayed out while others in the same email are okay.... how do I fix that? --------------Solutions------------- Hi, Please refer to my private message with regard to your concern. Make

  • Adera Partial downloading/installation error 0x80070002 2013-02-08

    Hey everyone, I am quite new to this Surface tablet PC, and someone else bought me this. My first reaction was, "Woo!? is this a PC or a iPad-like toy? I am not going to write a report with this thing." Apparently, with a few peripheries it does work

Copyright (C), All Rights Reserved.

processed in 0.137 (s). 11 q(s)