Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

O'Reilly Upload Package Issue

Thread view: 
sentzm@gmail.com - 08 Aug 2006 13:12 GMT
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??
Chris Uppal - 08 Aug 2006 16:03 GMT
> 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
Andrea Desole - 08 Aug 2006 16:18 GMT
> 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
[quoted text clipped - 17 lines]
>
> 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/
sentzm@gmail.com - 08 Aug 2006 19:45 GMT
> > 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
[quoted text clipped - 28 lines]
>
> 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.
Andrea Desole - 09 Aug 2006 09:24 GMT
> 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.aspx?scid=kb;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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.