HttpPostedFile.SaveAs メソッドとは何? わかりやすく解説 Weblio辞書 (original) (raw)
名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文
Public Sub SaveAs ( _ filename As String _ )
Dim instance As HttpPostedFile Dim filename As String
instance.SaveAs(filename)
public void SaveAs ( string filename )
public: void SaveAs ( String^ filename )
public void SaveAs ( String filename )
public function SaveAs ( filename : String )
アップロードされたファイルも含めた、要求のサイズの上限は、既定で 4 MB です。要求サイズの上限は、Machine.config ファイルまたは Web.config ファイル内の httpRuntime 要素 (ASP.NET 設定スキーマ) 要素の maxRequestLength 属性で指定します。特定のページに対する要求サイズの上限は、Web.config ファイル内の location 要素 (ASP.NET 設定スキーマ) 要素で指定できます。
クライアントによってアップロードされたすべてのファイルを、Web サーバーのローカル ディスクの C:\TempFiles フォルダに保存する方法を次のコード例に示します。
Dim Loop1 As Integer Dim TempFileName As String Dim MyFileCollection As HttpFileCollection = Request.Files
For Loop1 = 0 To MyFileCollection.Count - 1 ' Create a new file name. TempFileName = "C:\TempFiles\File_" & CStr(Loop1) ' Save the file. MyFileCollection(Loop1).SaveAs(TempFileName) Next Loop1
String TempFileName; HttpFileCollection MyFileCollection = Request.Files;
for (int Loop1 = 0; Loop1 < MyFileCollection.Count; Loop1++) { // Create a new file name. TempFileName = "C:\TempFiles\File_" + Loop1.ToString(); // Save the file. MyFileCollection[Loop1].SaveAs(TempFileName); }
String tempFileName; HttpFileCollection myFileCollection = get_Request().get_Files();
for (int loop1 = 0; loop1 < myFileCollection.get_Count(); loop1++) { // Create a new file name. tempFileName = "C:\TempFiles\File_" + String.valueOf(loop1); // Save the file. myFileCollection.get_Item(loop1).SaveAs(tempFileName); }
var tempFileName : String var myFileCollection : HttpFileCollection = Request.Files
for(var i=0; i < myFileCollection.Count; i++){ // Create a new file name. tempFileName = "C:\TempFiles\File_" + i // Save the file. myFileCollection[i].SaveAs(tempFileName) }
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
.NET Framework
サポート対象 : 2.0、1.1、1.0
関連項目
HttpPostedFile クラス
HttpPostedFile メンバ
System.Web 名前空間
その他の技術情報
httpRuntime 要素 (ASP.NET 設定スキーマ)
location 要素 (ASP.NET 設定スキーマ)