2012-05-21 123 views
1

我在一個項目上工作,我希望通過將其在文本框保存保存在內容/資產數據庫.curenttly我現在的儲蓄的路徑文件夾中的圖像的路徑,然後傳送到我的創造method.How我可以做一個相片挑選和保存路徑到我的文本? 這是我的觀點:圖像路徑文本框

@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> 

回答

1

什麼input type="file"

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

然後你可以掛接到jQuery中的變化時如果需要的話,像這樣:

$("#photo").change(function() { 
    //do your stuff 
});