O'Reilly Upload Package Issue

S

sentzm

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??
 
C

Chris Uppal

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
 
A

Andrea Desole

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/
 
S

sentzm

Andrea said:
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.
 
A

Andrea Desole

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top