|
Public Class upload
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsNothing(Request.Form("chunk")) = False Then
If Session("ID") Is Nothing Then
Session("ID") = Guid.NewGuid.ToString
IO.Directory.CreateDirectory(Server.MapPath("Uploads/" & Session("ID")))
End If
Dim chunk As Integer = Request.Form("chunk")
Dim chunks As Integer = Request.Form("chunks")
Dim filename As String = Request.Form("name")
If chunk = 0 Then
Request.Files(0).SaveAs(Server.MapPath("Uploads/") & Session("ID") & "/" & Request.Files(0).FileName)
Else
Dim OutputStream As New IO.FileStream(Server.MapPath("Uploads/") & Session("ID") & "/" & Request.Files(0).FileName, IO.FileMode.Append)
Dim InputBytes(Request.Files(0).ContentLength) As Byte
Request.Files(0).InputStream.Read(InputBytes, 0, Request.Files(0).ContentLength)
OutputStream.Write(InputBytes, 0, InputBytes.Length - 1)
OutputStream.Close()
End If
End If
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.