diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 08b5e0b81b983706dfd13816b5f5b84ce38a5efc..a31b7ec554a9492fed1824a7935e790b825b7eb7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -340,16 +340,14 @@ class ProjectsController < ApplicationController
     render :action => "list_news", :layout => false if request.xhr?
   end
 
-  def add_file  
-    if request.post?
-      # Save the attachment
-      if params[:attachment][:file].size > 0
-        @attachment = @project.versions.find(params[:version_id]).attachments.build(params[:attachment])      
-        @attachment.author_id = self.logged_in_user.id if self.logged_in_user
-        if @attachment.save
-          flash[:notice] = l(:notice_successful_create)
-          redirect_to :controller => 'projects', :action => 'list_files', :id => @project
-        end
+  def add_file
+    @attachment = Attachment.new(params[:attachment])
+    if request.post? and params[:attachment][:file].size > 0        
+      @attachment.container = @project.versions.find_by_id(params[:version_id])
+      @attachment.author = logged_in_user
+      if @attachment.save
+        flash[:notice] = l(:notice_successful_create)
+        redirect_to :controller => 'projects', :action => 'list_files', :id => @project
       end
     end
     @versions = @project.versions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 2e1e9b1567eeceb0bdfcf3b60d1556d5f1f39e18..aca86cec5f654c9c293ea05f28fdc2ae24be446b 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -21,7 +21,7 @@ class Attachment < ActiveRecord::Base
   belongs_to :container, :polymorphic => true
   belongs_to :author, :class_name => "User", :foreign_key => "author_id"
   
-	validates_presence_of :filename
+  validates_presence_of :container, :filename
 	
 	def file=(incomming_file)
 		unless incomming_file.nil?
@@ -35,6 +35,10 @@ class Attachment < ActiveRecord::Base
 		end
 	end
 	
+	def file
+	 nil
+	end
+	
 	# Copy temp file to its final location
 	def before_save
 		if @temp_file && (@temp_file.size > 0)
diff --git a/app/views/projects/add_file.rhtml b/app/views/projects/add_file.rhtml
index fee67c53f8770ba9d13c626557414a9cbe938ef6..cb478cb1628b375fa8c9d7389f5c2c5817b70594 100644
--- a/app/views/projects/add_file.rhtml
+++ b/app/views/projects/add_file.rhtml
@@ -1,14 +1,14 @@
 <h2><%=l(:label_attachment_new)%></h2>
 
 <%= error_messages_for 'attachment' %>
-<%= start_form_tag ({ :action => 'add_file', :project => @project }, :multipart => true) %>
+<div class="box">
+<%= start_form_tag ({ :action => 'add_file', :id => @project }, :multipart => true, :class => "tabular") %>
 
-<p><label for="version_id"><%=l(:field_version)%></label><br />
-<select name="version_id">
-<%= options_from_collection_for_select @versions, "id", "name" %>
-</select></p>
+<p><label for="version_id"><%=l(:field_version)%> <span class="required">*</span></label>
+<%= select_tag "version_id", options_from_collection_for_select(@versions, "id", "name") %></p>
 
-<p><b><%=l(:label_attachment)%><b><br /><%= file_field 'attachment', 'file'  %></p>
-<br/>
+<p><label for="attachment_file"><%=l(:label_attachment)%> <span class="required">*</span></label>
+<%= file_field 'attachment', 'file'  %></p>
+</div>
 <%= submit_tag l(:button_add) %>
 <%= end_form_tag %> 
\ No newline at end of file