Forum: Ruby on Rails send_file is behaving strange

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
535eb0617348da39410f63de18ae6f22?d=identicon&s=25 Surjya Hazarika (prasad)
on 2006-03-29 14:37
Hi all,
        I am using send_file("/path/to/my/file")to send a file from the
server to a client. The file is not empty but when displayed on the
client, it is totally blank. In windows system, it's working properly,
the problem is only with a linux server
807e34b31d5463a9ac05d41458a9e537?d=identicon&s=25 Al Evans (al-evans)
on 2006-03-29 15:19
surjya hazarika wrote:
> Hi all,
>         I am using send_file("/path/to/my/file")to send a file from the
> server to a client. The file is not empty but when displayed on the
> client, it is totally blank. In windows system, it's working properly,
> the problem is only with a linux server

If the file is the right size, are you setting its mime type when you
send it?

e.g.,

     send_file(User.photo_file_name_for(@params[:id]),
          {:disposition => 'inline', :type => 'image/jpeg'})

--Al Evans
This topic is locked and can not be replied to.