ASP.NET
示例
第一个示例演示如何创建 FileUpload 控件,该控件将文件保存到代码中指定的路径。
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void UploadButton_Click(object sender, EventArgs e)
{
// Specify the path on the server to
// save the uploaded file to.
String savePath = @"c:\temp\uploads\";
// Before attempting to perform operations
// on the file, verify that the FileUpload
// control contains a file.
if (FileUpload1.HasFile)
{
// Get the name of the file to upload.
String fileName = FileUpload1.FileName;
// Append the name of the file to upload to the path.
savePath += fileName;
// Call the SaveAs method to save the
// uploaded file to the specified path.
// This example does not perform all
// the necessary error checking.
// If a file with the same name
// already exists in the specified path,
// the uploaded file overwrites it.
FileUpload1.SaveAs(savePath);
// Notify the user of the name of the file
// was saved under.
UploadStatusLabel.Text = "Your file was saved as " + fileName;
}
相关文档:
在asp.net中使用FCKeditor,简单实用配置。
在下已经成功配置并使用,全部功能均可用,包含上传图片等。
在下环境
1.Microsoft Visual Web Developer 2005
2.FCKeditor.Net_2.6.3.zip 下载地址:http://download.csdn.net/source/1833985
3.FCKeditor_2.6.5.zip 下载地址:http://download.cs ......
<%=%>绑定CS文件中的变量,有值的属性,或者有返回值的方法,
<%#%>一般式放在数据控件中绑定数据源表中的字段
<%=%><%#%>区别:
前者 是在页面之中使用.属于一段代码.有=号的就相当于response.write()这功能.和asp一样.
后者 是在页面中的服务器数据控件中绑定数据源的字段 ......
一、上传图片:
将图片存储在image文件夹中,然后把图片的路径存在数据库里,这样用的时候从数据库中搜索出路径然后绑定在前台页面的<image/>标签中,就能显示我们想要的图片。
前台代码:
商品图片:<asp:FileUpload ID="ImageUpload" runat="server" />
<asp:Label ID="TipF ......
经过对asp.net的学,我觉得越来越力不从心啊!说实话我现在都不敢说自己已经入门了!有时候真想,我到底适合不适合学这个,我并不是遇到困难就想逃避,只是我找不到合适的方法来解决自己遇到的问题。都说千年磨一剑,现在才真正认识到,想要得到点儿东西,没有点付出和牺牲是可能的事!
&n ......
使用 FileUpload 控件,可以为用户提供一种将文件从其计算机发送到服务器的方法。
一、功能
可使用 FileUpload 控件执行下列操作:
·使用户能够上载存储在服务器上的特定位置的文件。
·限制可上载的文件的大小。
·在存储上载的文件之前检查其属性。
二 ......