file_field on widows

Hi to all,

i'm trying to upload a pdf or doc file on my server. My code works under linux, but now i move my app to a windows server and the documents (both pdf and doc) are not uplaoded correctly.

Here it's my form code in the view:

<%= form_tag( { :action => 'create' }, :multipart => true ) -%>

<p><label for="nominee_cv">Cv</label><br/> <%= file_field 'nominee', 'cv' %></p>

<%= submit_tag "Next" %> </form>

and this is my controller:

if(@nominee.cv != "")     file_field=@nominee.cv rescue nil

     ext=file_field.original_filename.to_s.split('.')

    File.open("#{$path}/public/cv/#{@nominee.id}.#{ext[1]}", "w") { |f| f.write(file_field.read)}         @nominee.cv="/cv/#{@nominee[:id]}.#{ext[1]}" end

Can anybody help me???

Thanks in advance

Andrea

Is $path what you think it is ? Where are things breaking down ?

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:

Is $path what you think it is ? Where are things breaking down ?

Fred

The $path is correct the file is saved in the correct folder.... And it seems coorect also the uploading of the file, i mean that there are no exception raised by Rails... But after, when i try to dowload the file i can't open it because it
is corrupted....

windows might be one of those weird operating systems where 'open in
binary mode' actually means something. (so pass wb as the file mode
when creating)

Fred

Frederick Cheung wrote: