edit uploaded file

how to edit uploaded file ???pls help..

i need to update uploaded file or image from directory as well as from
database ..

So let me make sure I understand:

1) you want to edit what about a document? Filename? Content-type?
If you want to edit the file itself, I'd think you'd have to download
it, edit it, and then reupload it.

2) When you say from directory as well as database, do you mean that
you want to be able to edit a file saved in the filesystem of the
server and a file saved as binary data in the database?

Give us a littl' more to work with so we can help...


thank u for your kind rply..
i ve uploaded file/image into database and folder named "data".. and i
also able to update the uploaded files/images in database ..but dont
know how to ..in folder "data"..

heres my controller file

def create
    @show =Show.new(params[:show])

    @show.filename= params[:show]['filename'].original_filename
    if @show.save
    post = Show.save(params[:show])
redirect_to :action => 'list'
def update
    @show = Show.find(params[:id])

    if @show.update_attributes(params[:show])

      flash[:notice] = 'Document was successfully updated.'
      redirect_to :action => 'list'
      render :action => 'edit'
def edit

model.rb file..

def self.save(product)
      name =product['filename'].original_filename
      path = File.join("public/data", name)
      File.open(path, "wb") { |f| f.write(product['filename'].read) }

<% form_tag ({ :action => 'create' },
              { :multipart => 'true' }) do%>
<p><label for="show_title">Title</label>:
<%=text_field 'show','title'%></p>
<p><label for="book_mobile_name">Mobile Type</label>:
<%=text_field 'show','mobilename'%></p>
<p><label for="book_price">Price</label>:
<%=text_field 'show','price'%>
<p><label for="book_description">Description</label>:
<%=text_field 'show','description'%></p>
<p><label for="book_file">Image</label>:
<%= file_field 'show', 'filename' %>
  <%= submit_tag "Send Attachment" %>
<% end %>


<% form_tag (:action => 'update', :multipart => true, :id => @show )do%>

<p><label for="filename">Description</label><br/>
<%=text_field 'show','title'%></p>
<%= file_field 'show', 'filename' %></p>
<%= @show.filename%>
<%= hidden_field( :hide, :value => @show.filename )%>
<%= submit_tag "Save changes" %>
<%end %>
<%= link_to 'Back', {:action => 'list' } %>