开发者

Upload Image through Jquery Modal

i want to upload photo to my application(asp.net mvc) using jquery Modal.

first i have created the div that will be displayed in the modal like the following :

<div id="dialog-form" title="Upload File">
    <p>
        <input type="file" id="fileUpload" name="fileUpload" />

     </p>
</div>

then when i press some Hyberlink the modal will appears and when i press ok i want to carry the photo to the action in controller for some proc开发者_开发百科essing ...

i dont know how to carry my photo to the server ...

the modal code looks like the following :

        $("#dialog-form").dialog({
            bgiframe: true,
            height: 200,
            modal: true,
            autoOpen: false,
            resizable: false,
            buttons: {
                Cancel: function () {
                    $(this).dialog('close');
                },
                Ok: function () {
                    $.ajax({
                        type: "POST",

                        url: '<%: Url.Action("Upload", "SomeController") %>',
                        success: function (result) {
                            if (result.Success == true) {
                                alert(result.Message);
                            }
                        }
                    });
                }
            }
        });

should i use the data in the $.ajax() .. but how ? and my controller expect from me nothing in signature... public JsonResult Upload() just like this

it looks for the uploaded files in Request.Files like :

foreach (string inputTagName in Request.Files) { some processing }

any help please ??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜