Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > O'Reilly Upload Package Issue

Reply
Thread Tools

O'Reilly Upload Package Issue

 
 
sentzm@gmail.com
Guest
Posts: n/a
 
      08-08-2006
I am using O'Reilly's upload package for html form based uploading and
I came across an issue when I upload text files. The files are uploaded
sucessfully, but when I access the file through a link, such as
www.[domainname].com/uploads/testfile.txt the file is displayed in
binary:

>?>ˀ
?/%?_/%,?̀?_?

How do I get text files to be displayed I guess in ASCII (plain
english!?!) so when the file is accessed through a web browser it
would display:

"This is a text file" and not the binary string shown above.

I noticed that in one of the MultipartRequest constructors in
O'Reilly's package, there is a String encoding argument. This might be
the answer to my question, but I am not exactly sure what the econding
String code should be.

Any ideas??

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      08-08-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Z??>?>???
> ?/%???_/%?,???_???


I can't think of any plausible combination of charset encoding problems which
would turn more-or-less pure ASCII English text into that kind of gibberish. I
suspect that the problem may be caused by some kind of confusion between client
and server over the use of compression, but that's just a guess. As in all
such cases, the /first/ thing to do is get hold of a copy of Ethereal (free)
and see what the client is really sending to the server and what the server is
really sending back.

-- chris


 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      08-08-2006
(E-Mail Removed) wrote:
> I am using O'Reilly's upload package for html form based uploading and
> I came across an issue when I upload text files. The files are uploaded
> sucessfully, but when I access the file through a link, such as
> www.[domainname].com/uploads/testfile.txt the file is displayed in
> binary:
>
> >?>ˀ
> ?/%?_/%,?̀?_?
>
> How do I get text files to be displayed I guess in ASCII (plain
> english!?!) so when the file is accessed through a web browser it
> would display:
>
> "This is a text file" and not the binary string shown above.
>
> I noticed that in one of the MultipartRequest constructors in
> O'Reilly's package, there is a String encoding argument. This might be
> the answer to my question, but I am not exactly sure what the econding
> String code should be.
>
> Any ideas??
>


I don't understand. If the files are uploaded successfully then it's not
a problem with the package. First check that the files are really
uploaded successfully.
That said, are you sure it's normal ascii and not unicode, or something
like that? If it is unicode I think that the encoding should help.
As a last question: why are you using the O'Reilly's package? Maybe you
should consider the Jakarta commons file upload, which has less license
problems and it's probably more used:

http://jakarta.apache.org/commons/fileupload/
 
Reply With Quote
 
sentzm@gmail.com
Guest
Posts: n/a
 
      08-08-2006

Andrea Desole wrote:
> (E-Mail Removed) wrote:
> > I am using O'Reilly's upload package for html form based uploading and
> > I came across an issue when I upload text files. The files are uploaded
> > sucessfully, but when I access the file through a link, such as
> > www.[domainname].com/uploads/testfile.txt the file is displayed in
> > binary:
> >
> > >?>ˀ
> > ?/%?_/%,?̀?_?
> >
> > How do I get text files to be displayed I guess in ASCII (plain
> > english!?!) so when the file is accessed through a web browser it
> > would display:
> >
> > "This is a text file" and not the binary string shown above.
> >
> > I noticed that in one of the MultipartRequest constructors in
> > O'Reilly's package, there is a String encoding argument. This might be
> > the answer to my question, but I am not exactly sure what the econding
> > String code should be.
> >
> > Any ideas??
> >

>
> I don't understand. If the files are uploaded successfully then it's not
> a problem with the package. First check that the files are really
> uploaded successfully.
> That said, are you sure it's normal ascii and not unicode, or something
> like that? If it is unicode I think that the encoding should help.
> As a last question: why are you using the O'Reilly's package? Maybe you
> should consider the Jakarta commons file upload, which has less license
> problems and it's probably more used:
>
> http://jakarta.apache.org/commons/fileupload/


The files are definitely uploaded successfully. When I try to access
the text file through the URL, instead of giving me the text file in
"plain english:" it gives me the file contents in that gibberish. I am
using this package because it was the decision of the IT shop to use it
rather than the Jakarta Struts upload. My initial throughts is it has
to do something with the encoding or something along those lines.

 
Reply With Quote
 
Andrea Desole
Guest
Posts: n/a
 
      08-09-2006
(E-Mail Removed) wrote:

> The files are definitely uploaded successfully. When I try to access
> the text file through the URL, instead of giving me the text file in
> "plain english:" it gives me the file contents in that gibberish. I am
> using this package because it was the decision of the IT shop to use it
> rather than the Jakarta Struts upload. My initial throughts is it has
> to do something with the encoding or something along those lines.


If you can open it with an editor and see its content I'm not sure it's
a package's fault. An ascii file doesn't have special properties. To be
sure you can make a file by yourself and see what happens. You can also
try to open the file from the browser as a normal file, without going
through the server.
You can look at the encoding, but I would rather look at the character
encoding, instead of the content encoding. Try to set the content type
header to something like "text/plain; charset=iso-8859-1". I'm not able
to go much further; if you want to know more I suggest to ask an http
newsgroup.
If you are using IE6 you can also try another browser. Apparently there
are some problems with the text/plain header. I just found this by accident:

http://support.microsoft.com/default...b;en-us;329661

In the worst case I would follow Chris' suggestion. Maybe Ethereal is a
bit low level for what you need, but you should check at least the
response headers coming from the server.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Package HTML - Missing package documentation file jochenhebbrecht@gmail.com Java 1 11-27-2007 01:59 PM
Package that imports with name of dependent package David Pratt Python 4 05-13-2006 05:12 PM
single package import v/s the entire package Parvinder Java 6 02-27-2005 02:02 PM
package module import name clash with global package George P Python 3 09-11-2004 01:19 PM
Importing a package and looping through modules in the package Dave Python 2 02-10-2004 08:14 PM



Advertisments