I am trying to get uploadify to work. When I try and upload something the browse functionality works fine but there is a breif pause and then I get either an "http error" or an "IO error".
The progress bar doesn't display, which made me think it might be a path issue, but the swf file is in the same location as the images / scripts which it appears to开发者_如何学Python be finding OK.
Anyone have any experience with this?
Did you use a generic handler (.ashx
) for receiving the file? Here is my code
Public Class Video_File_Upload
Implements System.Web.IHttpHandler
'Dim File_Path_Chapter_Video As String = "XXX/"
Dim Directory_Videos As String = System.Configuration.ConfigurationManager.AppSettings("Videos_Save")
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/plain"
context.Response.Expires = -1
Try
Dim postedFile As HttpPostedFile = context.Request.Files("Filedata")
Dim filename As String = postedFile.FileName
'string folderName = context.Request.QueryString["FolderName"];
Dim NOF As String
Dim CheckFilePath As String
Dim MapPath As String
NOF = Convert.ToString(context.Request("NOF"))
CheckFilePath = Directory_Videos & NOF
If Directory.Exists(CheckFilePath) = False Then
Directory.CreateDirectory(CheckFilePath)
End If
MapPath = Directory_Videos & NOF & "/" & filename
postedFile.SaveAs(MapPath)
Catch
End Try
End Sub
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
Then you have to put this line in the upload setting: "uploadScript:Video_File_Upload.ashx"
精彩评论