2012-05-21 58 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 
});