HttpPostedFile.InputStream プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpPostedFile.InputStream プロパティの意味・解説 

HttpPostedFile.InputStream プロパティ

アップロードされたファイルを示す Stream オブジェクト取得し、そのファイル内容読み取る準備をします。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As HttpPostedFile
Dim value As Stream

value = instance.InputStream
public Stream InputStream { get; }
public:
property Stream^ InputStream {
    Stream^ get ();
}
/** @property */
public Stream get_InputStream ()

プロパティ
ファイルを示す Stream

使用例使用例

クライアントファイル コレクション最初ファイル内容バイト配列読み込んで、そのバイト配列文字列コピーする方法次のコード例示します

Imports System
Imports System.Web
Imports System.Web.UI

Public Class Page1: Inherits
 Page

 Protected Loop1 As Integer
 Protected MyString As String

  Protected Sub Page_Load(sender As
 Object, e As EventArgs)

    Dim MyFileCollection As HttpFileCollection
    Dim MyFile As HttpPostedFile
    Dim FileLen As Integer
    Dim MyString As String
    Dim MyStream As System.IO.Stream
 
    MyFileCollection = Request.Files
    MyFile = MyFileCollection(0)
 
    FileLen = MyFile.ContentLength
    Dim Input(FileLen) As Byte
 
    ' Initialize the stream.
    MyStream = MyFile.InputStream
 
    ' Read the file into the byte array.
    MyStream.Read(input, 0, FileLen)
 
    ' Copy the byte array into a string.
    For Loop1 = 0 To FileLen-1
      MyString = MyString & Input(Loop1).ToString()
    Next Loop1
    
 End Sub

End Class
using System;
using System.Web;
using System.Web.UI;

public class Page1: Page
{
 protected string MyString;
 private void Page_Load(Object sender, EventArgs
 e)
 {
   HttpFileCollection MyFileCollection;
   HttpPostedFile MyFile;
   int FileLen;
   System.IO.Stream MyStream;
 
   MyFileCollection = Request.Files;
   MyFile = MyFileCollection[0];
 
   FileLen = MyFile.ContentLength;
   byte[] input = new byte[FileLen];
 
   // Initialize the stream.
   MyStream = MyFile.InputStream;
 
   // Read the file into the byte array.
   MyStream.Read(input, 0, FileLen);
 
   // Copy the byte array into a string.
   for (int Loop1 = 0; Loop1 < FileLen;
 Loop1++)
     MyString = MyString + input[Loop1].ToString();
    
 }
}
import System.*;
import System.Web.*;
import System.Web.UI.*;

public class Page1 extends Page
{
    protected String myString;
    private void Page_Load(Object sender, EventArgs
 e)
    {
        HttpFileCollection myFileCollection;
        HttpPostedFile myFile;
        int fileLen;
        System.IO.Stream myStream;

        myFileCollection = get_Request().get_Files();
        myFile = myFileCollection.get_Item(0);

        fileLen = myFile.get_ContentLength();
        ubyte input[] = new ubyte[fileLen];

        // Initialize the stream.
        myStream = myFile.get_InputStream();

        // Read the file into the byte array.
        myStream.Read(input, 0, fileLen);

        // Copy the byte array into a string.
        for (int loop1 = 0; loop1 < fileLen;
 loop1++) {
            myString = myString + input.get_Item(loop1).ToString();
        }
    } //Page_Load
} //Page1
import System
import System.Web
import System.Web.UI

class Page1 extends Page{

 var myString : String

  function Page_Load(sender : Object, e : EventArgs){
    var myFileCollection : HttpFileCollection
    var myFile : HttpPostedFile
    var fileLen : int
    var myString : String = ""
    var myStream : System.IO.Stream

    myFileCollection = Request.Files
    myFile = myFileCollection[0]

    fileLen = myFile.ContentLength
    var input : Byte[] = new Byte[fileLen]

    // Initialize the Stream.
    myStream = myFile.InputStream

    // Read the file into the byte array.
    myStream.Read(input, 0, fileLen)

    // Copy the Byte array into a string.
    for(var i=0; i < fileLen; i++){
      myString = myString + input[i].ToString()
    }

   }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からHttpPostedFile.InputStream プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHttpPostedFile.InputStream プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHttpPostedFile.InputStream プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HttpPostedFile.InputStream プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpPostedFile.InputStream プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS