File not uploading properly

Hi all,

I am using the following code to upload a file.

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

controller: file_path= "#{RAILS_ROOT}/public/email_attachments/#{params[:upload][:file].original_filename}" file = File.new(File.join(file_path), "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?