Sha256: 55f00bb8e93aaf3bd5f68281d646647f0049febb54d3165da54e1fd026b8ad2e
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
# code: # * George Moschovitis <gm@navel.gr> # # (c) 2004 Navel, all rights reserved. # $Id: requestpart.rb 167 2004-11-23 14:03:10Z gmosx $ require "cgi" require "ftools" require "glue/string" require "nitro/uri" require "nitro/http" require "nitro/server/cookie" module N # RequestPart # # This class encapsulates a part in a multipart request. # A part is typically an uploaded files. # class RequestPart # the filename of the part attr_accessor :filename # the original filename path attr_accessor :original_path # the temp filename path attr_accessor :body # the content-type attr_accessor :content_type def initialize(original_path, body, content_type = nil) @original_path = original_path @body = body @content_type = content_type # handle dos + unix separators. @filename = @original_path.split(/\/|\\/).last end # gmosx: # Hack fixed save for webrick! # def save(prefix, forced_filename = nil, forced_extension = nil) ::FileUtils.mkdir_p(prefix) save_path = "#{prefix}/#{@filename}" ::File.open(save_path, "wb") {|f| f.write @body } return save_path end end end # module
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.7.0 | lib/nitro/server/requestpart.rb |
nitro-0.5.0 | lib/nitro/server/requestpart.rb |
nitro-0.6.0 | lib/nitro/server/requestpart.rb |
nitro-0.8.0 | lib/nitro/server/requestpart.rb |