Hi I need to download a file from a http server which askes for user id and password to login. can someone help me out in downloading the file and place that in a database table.
Thanks in advance
Neela.V
Hi I need to download a file from a http server which askes for user id and password to login. can someone help me out in downloading the file and place that in a database table.
Thanks in advance
Neela.V
Jump to PostWe'll be glad to help, we will not, however, do it for you.
For starters, check out HttpURLConnection.
We'll be glad to help, we will not, however, do it for you.
For starters, check out HttpURLConnection.
Hi masijade,
I used the following code. That works only for sites which doesn'task for login credentials. My requirement is with login credentials. Please help me out.
import java.io.*;
import java.net.*;
public class SampleFile
{
public static void main(String args[]) throws IOException
{
java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
java.net.URL("http://bdonline.sqe.com/documents/testplans.pdf").openStream());
java.io.FileOutputStream fos = new java.io.FileOutputStream("testplans.pdf");
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
byte data[] = new byte[1024];
while(in.read(data,0,1024)>=0)
{
bout.write(data);
}
bout.close();
in.close();
}
}
Thanks
Neela.V
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.