Sha256: 6007b59cb898de90ae70edf593c0e64adeec0a6ad3f3d77b43c65e04b52d6d74
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# code: # * George Moschovitis <gm@navel.gr> # # (c) 2004 Navel, all rights reserved. # $Id: requestpart.rb 112 2004-10-27 10:59:55Z gmosx $ require "cgi" require "ftools" require "n/utils/string" require "n/utils/uri" require "n/utils/http" require "n/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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.3.0 | lib/n/server/requestpart.rb |