Luis Lavena wrote:
> On Tue, Sep 14, 2010 at 9:39 AM, Amit Tomar <li...@ruby-forum.com> 
> wrote:
>>
>> sorry luis but i didn't get you
>> i uploaded my file in filesystem than how ?can ?i place file in public
>> folder
>> could you please give some example??
>>
> 
> Are you using a plugin to manage your uploads? How are you saving the 
> file?
> 
> Take the temporary file and use File.move or FileUtils.mv, wonder what
> are you doing right now for that.
> 
> Please use google to search, there are plenty of file uploading
> tutorials about Ruby on Rails on the internet covering "do from
> scratch" or using gem/plugins.
> --
> Luis Lavena
> AREA 17
> -
> Perfection in design is achieved not when there is nothing more to add,
> but rather when there is nothing more to take away.
> Antoine de Saint-Exupé²¹

this is how am uploading
def upload(params)

        path = get_path(params)
        File.open(path, "wb") do |f|
        while buff= params[:location].read(4096)

        f.write(buff)
        end
        end
end

def get_path(params)
          name = params[:location].original_filename
    directory  = "//192.168.247.77/Smruti/streams"
                path = File.join(directory, name)
          return path
end


def copyFile(uploaded_file)
            @uploaded_file = uploaded_file
            directory = "//192.168.147.17/Smruti/streams"
            #url_dir = "data"
            url_dir = "//192.168.147.17/Smruti/streams"
            name = File.basename(@uploaded_file)
            path = File.join(directory, name)
          if (!FileTest.exist?(path))
             FileUtils.copy @uploaded_file, path
          else
               return "duplicate"
           end

            url = File.join(url_dir, name)
            return url

      end


end
and after copying it filesystem
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to