| |

VerySource

 Forgot password?
 Register
Search
View: 872|Reply: 8

How to use VB.NET to upload files with given HTTP address

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-22 21:00:01
| Show all posts |Read mode
How to use VB.NET to upload files with given HTTP address
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-5 02:30:01
| Show all posts
Wouldn't it be possible to use the Web Service's file stream, as well as ftp!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-6 22:15:02
| Show all posts
Use the UploadFile method to upload files, and specify the source file location and target directory location as strings or URIs, and specify the user name and password. This example uploads the Order.txt file to http://www.cohowinery.com/uploads.aspx, providing both the username anonymous and an empty password.


My.Computer.Network.UploadFile (_
"C:\My Documents\Order.txt", _
"http://www.cohowinery.com/upload.aspx", "anonymous", "")
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-9 11:30:01
| Show all posts
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Files As HttpFileCollection = HttpContext.Current.Request.Files
   
    Dim Serverpath As String = Server.MapPath ("..")&Me.Label1.Text.Trim
    Try
    
      For iFile 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 (Serverpath&FileName)
           End If
      Next
    Finally
    End Try
  End Sub
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-5-10 10:15:01
| Show all posts
HttpFileCollection and HttpPostedFile are not recognized! import can't get in
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-11 18:45:01
| Show all posts
Imports System.Text.StringBuilder
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-11 21:00:01
| Show all posts
Imports System.IO
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-12 08:30:01
| Show all posts
Remember to write this on the .ASPX page:
<form id = "Form1" method = "post" encType = "multipart / form-data" runat = "server">
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-16 00:30:02
| Show all posts
I guess it should be POST.
Agree with this:tuqiang
Remember to write this on the .ASPX page:
<form id="Form1" method="post" encType="multipart/form-data" runat="server">
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list