1

私はプロジェクトで作業しており、データベースの Content/assets フォルダーに保存された画像のパスを保存したいと考えています。写真ピッカーとパスをテキストボックスに保存しますか? これが私の見解です:

 @using (Html.BeginForm("Create", "Rooms", FormMethod.Get, new { @encType = "multipart/form-data" }))
 {
  <div class="editor-label">    
  @Html.Label("RoomNumber")
  @Html.TextBox("RoomNumber")
  </div>
  <div class="editor-label">
   @Html.Label("RoomType")
   @Html.DropDownList("RoomType_id", new SelectList(Model.tip.AsEnumerable(), "RoomType_ID", "Room_Type"))
   </div>
   @Html.Label("Floor")
   @Html.DropDownList("Floor_id", new SelectList(Model.etaj.AsEnumerable(), "Floor_ID", "Denumire"))
   <div class="editor-label">
   @Html.Label("NumberOfSpots")
   @Html.TextBox("NumberOfSpots")
   </div>
   <div class="editor-label">
   @Html.Label("Status")
   @Html.TextBox("Status")                   
   </div>
   <div class="editor-label">
   @Html.Label("Status")
   @Html.TextBox("Status")                   
   </div>
   <div class="editor-label">
   @Html.Label("AlbumArtUrl")
   @Html.TextBox("AlbumArtUrl")                  
   </div>
4

1 に答える 1

1

どうinput type="file"ですか?

<input id="photo" type="file" />

次に、必要に応じて、次のように jQuery の change イベントにフックできます。

$("#photo").change(function () {
    //do your stuff
});
于 2012-05-21T21:24:56.873 に答える