flex上传文件(flex+asp.net)
废话不说,直接代码部分代码摘抄自网上,在此想原作者表示感谢
1、服务端 uploadFile.ashx
<%@ WebHandler Language="VB" Class="UploadFile" %>
Imports System
Imports System.Web
Imports System.Web.HttpServerUtility
Imports System.IO
Imports System.Web.HttpRequest
Public Class UploadFile : Implements IHttpHandler
Private m_UploadPath As String = "~\Files\"
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/plain"
Dim responses As String = ""
Dim files As HttpFileCollection = context.Request.Files
If files.Count = 0 Then
'Response.Write("请勿直接访问本文件")
context.Response.End()
Else
' 只取第 1 个文件
Dim file As HttpPostedFile = files.Item(0)
If (file IsNot Nothing AndAlso file.ContentLength > 0) Then
Dim path_1 As String = context.Server.MapPath(m_UploadPath)
Dim today As DateTime = DateTime.Today
Dim dirname As String = String.Format("/Files/{0}/{1}/{2}/", today.Year, today.Month, today.Day)
&n
相关文档:
在用VS2008调试网站的时候,突然页面不能正常显示了,IE显示“无法显示该网页”。
症状一:
IE地址栏里面显示的端口号和桌面任务栏右下角“ASP.NET Development Server”的端口不一致,而把IE地址栏的端口号改成“ASP.NET Development Server”显示的端口号,结果网页就能出来。
解决 ......
ASP.NET中实现页面间的参数传递 (转载)
&n ......
数据处理成功马上跳转到另外一个页面!
你的后台处理页面,也就是数据接收页面,执行完相关的操作后,使用下面的语句:
response.write("<script>alert('数据提交成功******');window.location.href='你想要转向的页面的地址';</script>")
这样随便他返回后怎么刷新,显示的始终是“数据提交成功 ......
网页中出现“'sys' 未定义
”或“'Sys' is undefined”的错误。
此时我们要做的是在 web.config
中 <system.web> 一节下面添加类似
如下内容:
<httpHandlers>
<add
verb="GET,HEAD" path="ScriptResource.a ......
asp.net允许上传的文件的最大为4M
如果想要传更大的需要更改web.config文件
<system.web>
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
</ststem.web> ......