Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.IO
Imports System.Web.AspNetHostingPermission
Imports Newtonsoft.Json
Imports System.Net
' 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="webpad")> _
<Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<SoapDocumentService(RoutingStyle:=SoapServiceRoutingStyle.RequestElement)> _
<ToolboxItem(False)> _
Public Class webpad
Inherits System.Web.Services.WebService
<WebMethod> _
Public Function upfile(vstring As String, vbizno As String, vfile As String, vnet As String, vftpport As String, vdbname As String, vftplogin As String, vftpcode As String) As String
Dim iInt As Integer = 1, fileStream As FileStream = Nothing
vnet = "127.0.0.1"
If FtpFileFind("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno & "/", vfile, deCode(vftplogin), deCode(vftpcode)) = True Then
Return aryLast(vfile, ".")
Else
Try
Dim fileByte() As Byte = Convert.FromBase64String(vstring)
Dim mmStream As New MemoryStream(fileByte)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud", vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4), vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6), vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno, vftplogin, vftpcode)
fileStream = New FileStream(System.Web.Hosting.HostingEnvironment.MapPath("~/" & deCode(vdbname) & "/cloud/") & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno & "/" & vfile, FileMode.Create, FileAccess.ReadWrite)
mmStream.WriteTo(fileStream)
mmStream.Close()
fileStream.Close()
fileStream.Dispose()
Return aryLast(vfile, ".")
Catch ex As Exception
Return ex.ToString ' "系统错误!"
End Try
End If
End Function
End Class