本文介绍了如何使用jQuery ..发回ifram页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主页是这样的..

My Main Page Like this..

<body>
    <form id="form1"  runat="server">
    <div style="width: 500px">
        <div style="float:left;">
            <iframe id="iFramImage" src="FileUploader.aspx" frameborder="0"></iframe>
        </div>
        <div style="float:right">
            <asp:Image ID="imgUploaded" runat="server" AlternateText="Image"  Height="400" Width="300"/>
            </div>
    </div>
    <div>
        <asp:Button ID="bntSaveImage" runat="server" Text="Save Image" 

            onclick="bntSaveImage_Click" />
    </div>
    </form>
</body>



FileUploader.aspx



FileUploader.aspx

<body>
    <form id="form1"  runat="server">
    <div>
        <asp:HiddenField ID="hdnImagFileName" runat="server" />
        <asp:FileUpload ID="ImageUpload" runat="server"/>        
    </div>
    </form>
</body>



FileUploader.aspx.cs



FileUploader.aspx.cs

public void FileUpload()
{
    if (ImageUpload.HasFile)
    {
        if (CheckFileExtension(ImageUpload.FileName))
        {
            string filePath = "~/temp_image/" + ImageUpload.FileName;
            ImageUpload.SaveAs(Server.MapPath(filePath));
        }
    }
    hdnImagFileName.Value = ImageUpload.FileName;
}
protected bool CheckFileExtension(string FileName)
{
    string ext = Path.GetExtension(FileName);
    switch (ext.ToLower())
    {
        case ".jpg":
        case ".png":
        case ".bmp":
        case ".gif":
            return true;
        default:
            return false;
    }
}



现在我想要的是使用时从我的
文件保存控制中选择一个图像文件当时我在ifram的页面FileUploader.aspx中要调用FileUpload(),因此在该页面的哪个事件中我都将调用该函数,以便将我的文件上载到临时目录.



now what i want that when use select a image file from fileupload control held in my
ifram''s page FileUploader.aspx at that time i want to call FileUpload() so in which event of page i place that function call so my file will be uploaded at temp directory.

推荐答案


这篇关于如何使用jQuery ..发回ifram页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 08:50