-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I want to use Fileupload to get a file and write it a file on the local server. The Files.copy method seems handy for this. It seems Media.isBinary() uses the file extension to determine text from binary. So something like an SQL file appears to be binary. In any case I'd like to write the file as binary. I can't call media.getStreamData() if it appears to be text (it throws an exception). I don't want to write the file using a reader (media.getReaderData()) because the file may be binary (wrong file extension). Also Files.copy takes a reader and a character set. I don't know the character set nor do I want to risk character translation problems. I just want to get the raw data in a file.
Is it possible to get an InputStream from Media regardless of what Media thinks is in the file?
Thanks.
/Daryl
Asked: 2009-12-07 14:18:05 +0800
Seen: 388 times
Last updated: Dec 08 '09