Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET jQuery
Hi,
 
this is my ASPX page
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <table border="1">
            <tr>
                <td>
                    <input type="file" name="name" value="" />
                </td>
                <td>
                    <input type="button" name="name" value="Upload" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    [WebMethod]
    public static string Uploadfile()
    {
        //if(file uploaded successfully)
            return "File Uploaded";
        //else
            return "error";
    }
}
 
i want to upload single file by jQuery, but can't do it.
plz help me!!!
Posted 30-Jan-13 22:53pm
Comments
Gittu Dash at 31-Jan-13 5:02am
   
Where is the Upload Logic ?
Do you want to Upload Asynchronously ??
shajarian_lover at 31-Jan-13 5:04am
   
i want to send the selected file to asp code behind, then save it by Uploadfile()
function
Gittu Dash at 31-Jan-13 5:20am
   
Well then I'd Suggest you to use Ajax Async File Upload Control.
So if you don't have any problem use this.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You might find this[^] question provides a decent answer. The big question, though, is which browsers you need to support. If you have to support old browsers (i.e. IE7, etc), then you need to consider using IFrames to support this.
  Permalink  
Comments
Ankur\m/ at 31-Jan-13 5:04am
   
:thumbsup:
Nandakishorerao at 31-Jan-13 5:22am
   
superb answer.my 5..

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



Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100