Hi everyone,

I do not actually have web page i can test this with but would really appreciate anyone with experience on this topic.

You see i am trying to upload a html page called wt.html from my disk to a website called http://www.rt.com/rf/wt.html using the HttpUrlConnection by first authenticating myself into the server getting its outputstream and getting rady to transfer the data.

Here is where my program begins, when a html file is involved do i transfer the data in text form by reading the html tags one by one from the html file on my disk and transferring the html tags one by one using the PrintStream class

Or

can i just use the FileInputStream class to transfer the file from my disk to the server.

For zip files and other data format, i know that i can use the FileInputStream
and do this but for html i am not really that sure and hope that someone can shed some light on this topic for me or anyone that has experience in this arena as i do not actually have a webpage to test this problem with

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West

Recommended Answers

All 4 Replies

I would go ahead and use the FileInputStream, I just think it'll be easier.

FileInputStream is readonly, FileOutputStream is writeonly...

And those won't cover a scenario where you don't have a drivemapping to the remote site, you'll need a network stream wrapped around it as well for the correct protocol.

Hi everyone,

FileInputStream is readonly, FileOutputStream is writeonly

Yes sorry i meant FileOutputStream, it was a typo

And those won't cover a scenario where you don't have a drivemapping to the remote site, you'll need a network stream wrapped around it as well for the correct protocol.

Assuming that i have already gotten what you mention above all covered, do i need to transfer tags by tags or is the FileoutputStream sufficient.

Hoping to hear from you

Yours Sincerely

Richard West

You will need a ByteArrayOutputStream linked to your FileOutputStream.
That you can link to the network port and dump the content of the file as a stream, the content of the file is then completely irrelevant.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.