Forum: Ruby on Rails ArgumentError (string contains null byte) -- file upload pro

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Joe Van D. (Guest)
on 2006-02-28 13:09
(Received via mailing list)

Controller code:
    if params[:main_image]
      image =
      image.blob = params[:main_image].read
      @product.main_image.destroy if @product.main_image
      @product.main_image = image

When I try to display the image using send_data, I get the following
ArgumentError (string contains null byte):
    .//app/controllers/images_controller.rb:5:in `show'

Here's the image controller:
class ImagesController < ApplicationController
  def show
    image = Image.find params[:id]
    send_file image.blob, :type => 'image/jpeg', :disposition =>

Any ideas?
Joe Van D. (Guest)
on 2006-02-28 13:52
(Received via mailing list)
Gah, I wanted send_data, not send_file.
This topic is locked and can not be replied to.