Sql server and varbinary columns

anyone know how to pass a file to a varbinary column right now I'm
trying this.

view:
<% file_field 'stored_files', 'tmp_file', :enctype =>
'application/binary' %>

controller:
params[:stored_files][:file] = params[:stored_files][:tmp_file].read
params[:stored_files].delete('tmp_file')
#then regular controller create stuff new save etc...

This causes active record to try and create the varbinary object using
a sql INSERT statement:

  PredefinedTestParameter Create (0.000000) DBI::DatabaseError: 22005
(257) [unixODBC][FreeTDS][SQL Server]Implicit conversion from data type
varchar(max) to varbinary(max) is not allowed. Use the CONVERT function
to run this query.: INSERT INTO predefined_test_parameter
([numeric_value], [data_type], [date_time_value], [object_value],
[param_name], [step_id], [string_value], [sort], [test_run_id],
[test_session_id]) VALUES(NULL, 'File', NULL,
'%PDF-1.2%00%âaIO%00%01202 0 obj%00<< %00/Linearized 1 %00/O 205 %00/H
[ 1462 229 ] %00/L 35078 %00/E 12235 %00/N 1 %00/T 30919 %00>>
%00endobj%00 xref%00202 32 %000000000016 00000 n%00%010000000991 00000
n%00%010000001324 00000n%00%010000001691 000')

this produces an error from sqlserver because you are trying to pass a
varchar to a varbinary. any idea how this is supposed to work on ruby
on rails? My application server is on linux, does it need to be on
windows to get this to work?