File not uploading properly

Hi all,

I am using the following code to upload a file.

<%= file_field "upload", 'file' ,:size=> '30' %>

file =, "wb")
file.write(params['file_' + i.to_s].read)

Next I am attaching the uploaded file and sending an email. Everything
is working fine.

BUT, If I attach a big size file or Image,

What exactly is a big size file? I mean, starting from what size is
considered big?

the file will not be uploaded
completely. For Example If I upload a big image, I ll be able to see
only half of the image, can anyone tell me the reason and solution to
this problem.

Maybe you're getting some timeout error?
Maybe you can try some plugin for file upload such as attachment_fu or
paperclip or anyone you like.
Is there any reason why you're not using some of this and doing the
file creation by hand?