Hi friends,
i am a fresher to ruby on rails . i need sample code/program of how to download or upload files,and i also want code to stage a file instead of posting it to a webserver.
i would be thankful if u can give me this information
Hi friends,
i am a fresher to ruby on rails . i need sample code/program of how to download or upload files,and i also want code to stage a file instead of posting it to a webserver.
i would be thankful if u can give me this information
read the manual (api.rubyonrails.org) and perhaps try this:
in your view:
<div class="title_heading">Fileupload <%= start_form_tag({:action => 'upload_file'}, :multipart => true) %> <%= file_field_tag("uploaded_file")%> <%= submit_tag('Save')%> <%= end_form_tag %> </div>
in the controller:
def upload_file file_content = "" file_io = params[:uploaded_file] file_io.each_line {|line| } render :text => "duh..."
end