0

getting 0 size byte array from media.getByteData() method if size is more than 200 kb

asked 2012-01-05 12:40:43 +0800

Djbhuva gravatar image Djbhuva
27

Hi,
i am uploading csv file which contains 1365 rows and the file size is 211 kb using following code.

byte[] mediaBytes = null;

Media media = Fileupload.get();

mediaBytes = media.getByteData();

but when i am inspecting object mediaBytes it is showing array with 0 length.

if i will print media.getByteData().length it is printing 0. means it can not take as much records.

if i decrease my file size with 600 records, it works fine.

i am setting max-upload-size in my zk.xml as shown as below but it is not working.

<?xml version="1.0" encoding="UTF-8"?>
<zk>
<system-config>
<max-upload-size>10240</max-upload-size>
</system-config>
<system-config>
<disable-event-thread>false</disable-event-thread>
</system-config>
</zk>

is this issue is ralated to file size. or any server related issue?

kindly provide solution for this.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-01-05 13:05:32 +0800

Bobzk gravatar image Bobzk
444 1 8

You need to check if it is in memory or a stream. Some Python code looks like :

if media.inMemory():
buf = ByteBuffer.wrap(media.getByteData())
else:
med = media.getStreamData()
fc = med.getChannel()
buf = fc.map(MapMode.READ_ONLY, 0, fc.size())

You'll have to do your own java conversion.

link publish delete flag offensive edit

answered 2012-01-06 05:56:41 +0800

Djbhuva gravatar image Djbhuva
27

hi Bobzk
what is fc and med

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-05 12:40:43 +0800

Seen: 296 times

Last updated: Jan 06 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More