🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1229

Re: How to get content of a text file from client post by web page

#1229
From: Joi Ellis [TeamB]
Date: Tue, 16 Apr 2002 09:51
30 lines
2405 bytes
In borland.public.jbuilder.java.api Angry Orca <luke@email.newpalm.com> wrote:
> Hi, all:
> I encounter a problem here while I am using the jsp.
> In the client page, I use this input to post a text file to the server side.

> <p><input type="file" size=40 name="file" value="*.txt"></p>

> On the server side, what should I do to get the content of the file?
> The tutorial says this:
> To read character data, use the BufferedReader object returned by the
> request��s getReader method. To read binary data, use the ServletInputStream
> returned by getInputStream.

> But the problem is the construction of BufferedReader need another
> inputstream!! What should I do??

I think they mean that you have a request object, and you do something like

  BufferedReader myfile = request.getReader();
or
  ServletInputStream myfile = request.getInputStream();

depending upon the type of data you expect to be receiving.

-- 
Joi Ellis (TeamB)               http://www.teamb.com/
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Guidelines: http://www.borland.com/newsgroups/guide.html
Only posts which violate the rules in guide.html are subject to cancelation.
Technical Details
Message-ID: <3cbbf40b_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed1.cidera.com!Cidera!dca6-feed2.news.algx.net!allegiance!nntp.abs.net!uunet!dca.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mail
References: <3cbbece2_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,6b7f0acc204b911f
X-Google-Attributes: gid1089d0,public
X-Google-Thread: f74b3,6b7f0acc204b911f
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2002-04-16 02:59:07 PST
Sender: Joi Ellis <joi@artoo.gyles19.visi.com>
Message-ID: <3cbbf40b_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: How to get content of a text file from client post by web page
Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language
References: <3cbbece2_1@dnews>
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.2.19-6.2.7 (i686))
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 209.98.6.107
Date: 16 Apr 2002 02:51:07 -0700
X-Trace: dnews 1018950667 209.98.6.107 (16 Apr 2002 02:51:07 -0700)
Lines: 30
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed1.cidera.com!Cidera!dca6-feed2.news.algx.net!allegiance!nntp.abs.net!uunet!dca.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews!not-for-mail