All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
WML Script标准函数库_[XML教程]
PHP基础:PHP4和PHP5的配置异同比较_php资料_编程技术
在C#中建立复杂的、灵活的SQL查询命令
用PHP程序实现从数组里筛选出重复的数据_php资料_编程技术
C#教程:线程的创建
C#教程:POP3与SMTP协议使用实例
脚本代码:实例解析Js+XML的操作方法_JavaScript技术_编程技术
ASP.NET中用哪种方式表格化数据_[Asp.Net教程]
ASP.NET中Session的状态保持方式浅议_.net资料_编程技术
ASP.NET2.0站点登录、导航与权限管理_[Asp.Net教程]
Reading number is top 10 pictures
Very beautiful interior decoration
Terrorist smile the largest human history an explosion2
29 the belle stars after bath figure5
The money of more than 100 countries and regions1
Sora aoi mirror memorial classics3
史上最大的哺乳动物迁移
Female model behind the bitterness, often being overcharged2
[猫扑大杂烩]华东师范墙上看到的捐精告示 15毫升3600元
A letter to parents choose world of warcraft seven big reason
教你做读书笔记
Download software ranking
在线棋牌游戏3.05版
软件工程思想
Unix video tutorial9
Twenty piece of palm leaf
Unix video tutorial1
Tram sex maniac 2 (H) rar bag6
Unix video tutorial2
星际争霸1.08硬盘免安装版
Professional killers2 for Android
matrix3
aaa published in(发表于) 2013/12/8 7:48:45 Edit(编辑)
ASP.NET2.0,上传图片并为用户创建相应文件夹_.net资料_编程技术

ASP.NET2.0,上传图片并为用户创建相应文件夹_.net资料_编程技术

ASP.NET2.0 上传图片并为用户创建相应文件夹_.net资料_编程技术-你的首页-uuhomepage.com

//前台代码


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >

无标题页





&nbsp;&nbsp;&nbsp;&nbsp;






//后台代码


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


}
protected void Button1_Click(object sender, EventArgs e)
{
string UploadFileName, UploadFileLastName;
UploadFileName = FileUpload1.PostedFile.FileName;//文件在本地的原始位置
UploadFileLastName = UploadFileName.Substring(UploadFileName.LastIndexOf(".") + 1);//得到文件的扩展名
Random rd = new Random();//产生随机数
int valationNo = 10 + rd.Next(99);//产生随机数
string suiji = valationNo.ToString();//产生随机数
string UpLoadFileTime = DateTime.Now.ToString("yyyyMMddHHmmss") + suiji;//得到系统时间并加上随机数以便生成上传图片名称
string NewUploadFileName = UpLoadFileTime + "." + UploadFileLastName;//产生上传图片的名称


string UserDirectory = "TestFile";//所要创建文件夹的名字,实际运用中可为用户注册ID
string UserPath = Server.MapPath("UploadFiles").ToString() + "\\" + UserDirectory + "\\" + "ProductsImages";
if (!Directory.Exists(UserPath)) //如果文件夹不存在则创建
{
Directory.CreateDirectory(UserPath);
}
FileUpload1.PostedFile.SaveAs(NewUploadPahtName);//用保存的方法将图片上载
string sUser_ProductsImageUrl = "UploadFiles/" + UserDirectory + "/" + "ProductsImages/" + NewUploadFileName;//得到服务端图片的虚拟路径
//Response.Write(sUser_ProductsImageUrl);
}
}






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.