Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はMVCを使用しています。画像をアップロードして同じページに表示する必要があります。画像をアップロードし、画像をローカルフォルダーに保存しました。mvcを使用してローカルフォルダーファイルから画像を表示する方法
最善の方法は、フォルダーからファイルをロードして返すアクションを作成することです。
使用FileContentResult:
FileContentResult
public FileContentResult Display(string filename) { byte[] byteArray = GetImageFromDisk(filename); return new FileContentResult(byteArray, "image/jpeg"); }
上記は、非常に単純化されたサンプルです。