Action Dispatch HTTP UploadedFile
模擬上傳檔案。
實際檔案可透過 tempfile
存取器取得,為了方便起見,部分介面可以直接使用。
上傳的檔案是暫時性檔案,其生命週期為一個請求。當物件被釋放時,Ruby 會刪除該檔案,因此不需要使用額外的維護任務來清理它們。
方法
- C
- E
- O
- P
- R
- S
- T
屬性
[讀寫] | 內容類型 (content_type) | 一個包含檔案 MIME 類型的字串。 |
[讀寫] | 標頭 (headers) | 一個包含 multipart 請求標頭的字串。 |
[讀寫] | 原始檔名 (original_filename) | 客戶端中檔案的基本名稱 (basename)。 |
[讀寫] | 暫存檔案 (tempfile) | 一個包含實際上傳檔案的 |
實體公開方法
close(unlink_now = false) 連結
tempfile.close
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 73 def close(unlink_now = false) @tempfile.close(unlink_now) end
eof?() 連結
tempfile.eof?
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 98 def eof? @tempfile.eof? end
open() 連結
tempfile.open
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 68 def open @tempfile.open end
path() 連結
tempfile.path
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 78 def path @tempfile.path end
read(length = nil, buffer = nil) 連結
tempfile.read
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 63 def read(length = nil, buffer = nil) @tempfile.read(length, buffer) end
rewind() 連結
tempfile.rewind
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 88 def rewind @tempfile.rewind end
size() 連結
tempfile.size
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 93 def size @tempfile.size end
to_io() 連結
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 102 def to_io @tempfile.to_io end
to_path() 連結
tempfile.to_path
的捷徑。
來源:顯示 | 在 GitHub 上
# File actionpack/lib/action_dispatch/http/upload.rb, line 83 def to_path @tempfile.to_path end