Well, there's a limit to what I can do since that URL is on your LAN, and I don't have access to it.
However, it seems like it is getting the file name correctly as * You_Should_Be_Working.jpg*. I would go to that URL in a web browser and make sure it shows the image. It would not surprise me if the JSP script at that URL is buggy. It also would not surprise me if it has something to do with using port 8080. Port 80 is much more likely to be "open" and unfiltered. Let me know if the image here shows okay in your web browser: http://192.168.9.67:8080/branch15/control/ipw/downloadFile?fileName=You_Should_Be_Working_1921117838.jpg&directory=attachment/AUDIT&displayfile=You_Should_Be_Working.jpg Thanks. On Wednesday, May 22, 2013 1:33:34 AM UTC-5, rahul kaushik wrote: > > > http://192.168.9.67:8080/branch15/control/ipw/downloadFile?fileName=You_Should_Be_Working_1921117838.jpg&directory=attachment/AUDIT&displayfile=You_Should_Be_Working.jpg > > Thanks > > > On Tue, May 21, 2013 at 7:58 PM, bob <[email protected]<javascript:> > > wrote: > >> What is the URL you are downloading from? >> >> Thanks. >> >> >> On Tuesday, May 21, 2013 4:45:44 AM UTC-5, rahul kaushik wrote: >> >>> yes am searching for the"=" sign and i have set both the permissions but >>> same result >>> >>> Thanks >>> >>> >>> >>> On Tue, May 21, 2013 at 1:18 AM, bob <[email protected]> wrote: >>> >>>> Actually, I was looking at your code some more, and *I would want to >>>> know the URL you are downloading from* to get a better idea of the >>>> correctness. I see that you are searching for an equals sign and using >>>> that to find the file name. >>>> >>>> If it turns out you are coming up with an okay file name, the problem >>>> is almost certainly one of permissions - you will need INTERNET permission >>>> as well as WRITE_EXTERNAL_STORAGE. >>>> >>>> Thanks. >>>> >>>> >>>> On Monday, May 20, 2013 7:25:12 AM UTC-5, rahul kaushik wrote: >>>> >>>>> Hi, >>>>> >>>>> I am trying to download the file as this is 2 mb but it is downlaoding >>>>> only 7.1 kb below is my code >>>>> class DownloadFileFromURL extends AsyncTask<String, String, String> { >>>>> >>>>> /** >>>>> * Before starting background thread Show Progress Bar Dialog >>>>> * */ >>>>> @Override >>>>> protected void onPreExecute() { >>>>> super.onPreExecute(); >>>>> showDialog(progress_bar_type)****; >>>>> } >>>>> >>>>> /** >>>>> * Downloading file in background thread >>>>> * */ >>>>> @Override >>>>> protected String doInBackground(String... f_url) { >>>>> int count; >>>>> final int BUFFER_SIZE = 128; >>>>> File root = android.os.Environment.**getExte** >>>>> rnalStorageDirectory(); >>>>> try { >>>>> URL url = new URL(f_url[0]); >>>>> String fileName=url.toString();; >>>>> // String Filename= getFileName(url); >>>>> >>>>> String newpath = fileName.replace('\\','/'); >>>>> int start = newpath.lastIndexOf("="); >>>>> if ( start == -1) >>>>> { >>>>> start = 0; >>>>> } >>>>> else >>>>> { >>>>> start = start + 1; >>>>> } >>>>> String pageName = newpath.substring(start, >>>>> newpath.length()); >>>>> >>>>> >>>>> long startTime = System.currentTimeMillis(); >>>>> Log.d("getFileName", pageName); >>>>> >>>>> >>>>> URLConnection ucon = url.openConnection(); >>>>> ucon.connect(); >>>>> int lengthofFile = ucon.getContentLength(); >>>>> /* >>>>> * Define InputStreams to read from the URLConnection. >>>>> */ >>>>> InputStream is = ucon.getInputStream(); >>>>> BufferedInputStream bis = new BufferedInputStream(is); >>>>> >>>>> /* >>>>> * Read bytes to the Buffer until there is nothing more >>>>> to read(-1). >>>>> */ >>>>> ByteArrayBuffer baf = new ByteArrayBuffer(50000); >>>>> int current = 0; >>>>> while ((current = bis.read()) != -1) { >>>>> baf.append((byte) current); >>>>> } >>>>> >>>>> /* Convert the Bytes read to a String. */ >>>>> File file = new File(fileName); >>>>> FileOutputStream fos = new FileOutputStream(Environment.* >>>>> *g**etExternalStorageDirectory().**t**oString()+ "/"+pageName.trim()); >>>>> //Log.d("root:", root.toString()); >>>>> fos.write(baf.toByteArray()); >>>>> fos.close(); >>>>> Log.d("ImageManager", "download ready in" >>>>> + ((System.currentTimeMillis() - >>>>> startTime) / 1000) >>>>> + " sec"); >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> } catch (Exception e) { >>>>> Log.e("Error: ", e.getMessage()); >>>>> } >>>>> >>>>> return null; >>>>> } >>>>> >>>>> /** >>>>> * Updating progress bar >>>>> * */ >>>>> protected void onProgressUpdate(String... progress) { >>>>> // setting progress percentage >>>>> pDialog.setProgress(Integer.**p**arseInt(progress[0])); >>>>> } >>>>> >>>>> /** >>>>> * After completing background task Dismiss the progress dialog >>>>> * **/ >>>>> @Override >>>>> protected void onPostExecute(String file_url) { >>>>> // dismiss the dialog after the file was downloaded >>>>> dismissDialog(progress_bar_**ty**pe); >>>>> // String imagePath = Environment.**getExternalStorage** >>>>> Directory().**toString() + "/downloadedfile.jpg"; >>>>> // setting downloaded into image view >>>>> // my_image.setImageDrawable(**Dra**wable.createFromPath(** >>>>> imagePath**)); >>>>> } >>>>> >>>>> } >>>>> >>>>> PLease Suggest >>>>> Thanks >>>>> RK >>>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To post to this group, send email to android-d...@**googlegroups.com >>>> >>>> To unsubscribe from this group, send email to >>>> android-developers+**[email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to android-developers+**[email protected]. >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>> >>> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

