内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

文件上傳后臺(tái)和前臺(tái)代碼(文件下載也是)-創(chuàng)新互聯(lián)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
    {

    }
protected void btupload_Click(object sender, EventArgs e)
    {
if (FileUpload1.HasFile)
        {
string filecontentType = FileUpload1.PostedFile.ContentType;
if (filecontentType == "image/bmp" || filecontentType == "image/gif" || filecontentType == "image/pjpeg" || filecontentType == "image/jpeg")
            {
string name = FileUpload1.PostedFile.FileName;
                FileInfo file= new FileInfo(name);
string filename = file.Name;
string webFilePath = Server.MapPath("image/" + filename);
if (!File.Exists(webFilePath))
                {
try
                    {
                        FileUpload1.SaveAs(webFilePath);
this.lmsg.Text = "提示:文件" + filename + "上傳成功!";
this.lpathInfo.Text = "image/" + filename;
this.iPic.ImageUrl = "image/" + filename;
                    }
catch (Exception ex)
                    {
this.lmsg.Text = "提示文件上傳失敗,失敗原因" + ex.Message;

                    }
                }
else
                {
this.lmsg.Text = "該文件已經(jīng)存在!";
                }
            }
else {
this.lmsg.Text = "提示:文件類(lèi)型不符";
            }
        }
    }
}
前臺(tái)代碼如下:文件上傳后臺(tái)和前臺(tái)代碼(文件下載
也是) <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="upload" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td><asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button ID="btupload" runat="server" onclick="btupload_Click" Text="上傳" /> <asp:Image ID="iPic" ImageUrl="" Height="100px" runat="server" /> </td> </tr> <tr><td> <asp:Label ID="lmsg" runat="server" Text="Label"></asp:Label>      <asp:Label ID="lpathInfo" runat="server" Text="Label"></asp:Label> </td></tr> </table> </div> </form> </body> </html>

 文件下載代碼

創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿(mǎn)足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的黟縣網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

分享題目:文件上傳后臺(tái)和前臺(tái)代碼(文件下載也是)-創(chuàng)新互聯(lián)
地址分享:http://www.rwnh.cn/article0/cspeio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、搜索引擎優(yōu)化、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站收錄、微信公眾號(hào)、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

綿陽(yáng)服務(wù)器托管
光泽县| 扶风县| 客服| 肃宁县| 九台市| 鄂托克前旗| 伊吾县| 金华市| 扶余县| 谢通门县| 灌云县| 惠州市| 明光市| 尼木县| 策勒县| 司法| 吉林省| 石家庄市| 汝南县| 扶绥县| 扎赉特旗| 正宁县| 景洪市| 神池县| 安多县| 青田县| 通州区| 土默特右旗| 开江县| 揭阳市| 崇信县| 拉孜县| 盐源县| 丰县| 金乡县| 乌什县| 白玉县| 江城| 南岸区| 庆阳市| 蒲江县|