如何使用jquery在asp中上传单个文件 [英] how to upload single file in asp using jquery

查看:82
本文介绍了如何使用jquery在asp中上传单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这是我的ASPX页面



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希望通过jQuery上传单个文件,但不能这样做。

plz帮帮我!!!



i want to upload single file by jQuery, but can''t do it.
plz help me!!!

推荐答案

你可能会发现 this [ ^ ]问题提供了一个不错的答案。但问题是,您需要支持哪些浏览器。如果你必须支持旧的浏览器(即IE7等),那么你需要考虑使用IFrame来支持它。
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.


这篇关于如何使用jquery在asp中上传单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆