Click here to Skip to main content
15,914,070 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Main Page Like this..

ASP.NET
<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

ASP.NET
<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

C#
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;
    }
}


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.
Posted

1 solution

This has nothing to do with JQuery. As the multitude of examples available on the web show, you would have a button, or some other control to initiate the postback. Call the upload method from that event.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900