真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網站制作重慶分公司

vb.net文件上傳 vbnet fileget

跪求在visual studio2005下用腳本任務vb.net實現(xiàn)上傳文件至FTP功能(應用變量)

Const?SYNCHRONIZE?=?H100000

創(chuàng)新互聯(lián)是一家專注于網站設計、成都做網站與策劃設計,新華網站建設哪家好?創(chuàng)新互聯(lián)做網站,專注于網站建設10年,網設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:新華等地區(qū)。新華做網站價格咨詢:18980820575

Const?INFINITE?=?HFFFFFFFF

Private?Declare?Function?OpenProcess?Lib?"kernel32"?(ByVal?dwDesiredAccess?As?Long,?ByVal?bInheritHandle?As?Long,?ByVal?dwProcessId?As?Long)?As?Long

Private?Declare?Function?CloseHandle?Lib?"kernel32"?(ByVal?hObject?As?Long)?As?Long

Private?Declare?Function?WaitForSingleObject?Lib?"kernel32"?(ByVal?hHandle?As?Long,?ByVal?dwMilliseconds?As?Long)?As?Long

Private?Sub?Command1_Click()

Dim?filename?As?String

Dim?ftp?As?String

Dim?uname?As?String

Dim?upin?As?String

ftp?=?InputBox("請輸入服務器地址")

uname?=?InputBox("請輸入帳號",?,?"anonymous")

upin?=?InputBox("請輸入密碼",?,?"IE@User")

filename?=?Timer()

Open?filename??".script"?For?Output?As?#1

Print?#1,?"user"

Print?#1,?uname

Print?#1,?upin

Print?#1,?"pwd"

Print?#1,?"hash"

Print?#1,?"put?"??filename??".txt"

Print?#1,?"quit"

Close?#1

Open?filename??".txt"?For?Output?As?#1

Print?#1,?Text1.Text

Print?#1,?Combo1.Text

Close?#1

DoEvents

Dim?pId?As?Long,?pHnd?As?Long

pId?=?Shell("ftp?-n?-s:"??filename??".script"??"?"??ftp,?vbHide)

pHnd?=?OpenProcess(SYNCHRONIZE,?0,?pId)

If?pHnd??0?Then

Call?WaitForSingleObject(pHnd,?INFINITE)

Call?CloseHandle(pHnd)

End?If

Kill?filename??".script"

End?Sub

如果你覺得可以,把100分給我吧

我的方法很另類,給你說說過程

為了不重復文件名,我取時間為文件名filename

生成filename.script腳本,傳輸FTP用

生成filename.txt保存了combo1和text1的文字

調用ftp命令傳輸,不需要inet或winsock控件

API是SHELL WAIT功能,因為script腳本保存了帳號和密碼,當傳輸完成后刪除filename.script腳本

覺得如何,如果用inet不如這個簡單,畢竟FTP不是自己寫的,不管PASV與否都正常使用,唯一就是密碼保存要等傳輸完成

你想的第一個方案是不可能的,F(xiàn)TP是文本傳輸協(xié)議,與HTTP不一樣,不能寫POST,實在想那樣,VB做不了,需要手動創(chuàng)建數據包欺騙服務器

vb.net ftp上傳文件

Dim OpenFileDialog As New OpenFileDialog

OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments

OpenFileDialog.Filter = "文本文件(*.jpg)|*.jpg|所有文件(*.*)|*.*"

If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then

Dim FileName As String = OpenFileDialog.FileName

' TODO: 在此處添加打開文件的代碼。

textbox1.Text = FileName

End If

第一個按鈕 上傳

Dim filelast As String = fileaddbefore.Text.Substring(fileaddbefore.Text.LastIndexOf("."), fileaddbefore.Text.Length - fileaddbefore.Text.LastIndexOf("."))

MessageBox.Show(filelast)

My.Computer.Network.UploadFile(textbox1.Text, "" 文件名.Text filelast, "登錄名1", "登錄密碼", True, 100)

第二個按鈕

用VB.NET 怎樣通過給的HTTP地址上傳文件

e As Int32 = 0 To Files.Count - 1

Dim PostedFile As HttpPostedFile = Files(iFile)

Dim FileName, FileExtent As String

FileName = Serverpath System.IO.Path.GetFileName(PostedFile.FileName)

If System.IO.Path.GetFileName(PostedFile.FileName) "" Then

FileName = System.IO.Path.GetFileName(PostedFile.FileName)

Dim Url As String = Me.Label1.Text.Trim FileName

PostedFile.SaveAs(Serve

vb.net 中如何將圖片保存到SQL數據庫

#Region "二進制文件的存儲函數" Public Function BinaryToFile(ByRef TableRowColItem As Object, ByVal FileName As String) As Boolean Dim data As Byte() = TableRowColItem

Dim myfilestream As New System.IO.FileStream(FileName, IO.FileMode.Create)

myfilestream.Write(data, 0, data.Length)

myfilestream.Close()

Return True

End Function Public Function BinaryToImage(ByRef TableRowColItem As Object, ByRef image As Image) As Boolean Dim data As Byte() = TableRowColItem Dim imgStream As New System.IO.MemoryStream '(data)

imgStream.Write(data, 0, data.Length)

image = System.Drawing.Image.FromStream(imgStream)

imgStream.Close()

imgStream.Dispose() Return True

End Function

Public Function BinaryFromFile(ByVal FileName As String, ByRef TableRowColItem As Object) As Boolean Using myfilestream As New FileStream(FileName, FileMode.Open, FileAccess.Read)

Dim data() As Byte

ReDim data(myfilestream.Length - 1)

myfilestream.Read(data, 0, myfilestream.Length)

myfilestream.Close()

TableRowColItem = data End Using

Return True

End Function Public Function BinaryFromImage(ByRef Image As Image, ByRef TableRowColItem As Object) As Boolean

Dim imgStream As New MemoryStream

Dim b As New Bitmap(Image) b.Save(imgStream, System.Drawing.Imaging.ImageFormat.Jpeg) Dim data As Byte() = imgStream.GetBuffer

TableRowColItem = data

data = TableRowColItem

imgStream.Close()

imgStream.Dispose() Return True

End Function Public Function BinaryFromImage(ByVal Image As Image, ByRef TableRowColItem As Object, ByVal imgFormat As System.Drawing.Imaging.ImageFormat) As Boolean

Dim imgStream As New MemoryStream

'Image.Save(imgStream, imgFormat)

'Dim b As New Bitmap(Image)

'b.Save("c:\a.bmp", imgFormat)

'b.Save("c:\a.bmp", imgFormat) Dim data As Byte() = imgStream.GetBuffer TableRowColItem = data

data = TableRowColItem

imgStream.Close()

Return True

End Function

#End Region


當前名稱:vb.net文件上傳 vbnet fileget
瀏覽地址:http://weahome.cn/article/ddoceic.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部