Sends the specified file to the specified host address.
Namespace:
Microsoft.VisualBasic.Devices
Assembly:
Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Visual Basic (Declaration)
Public Sub UploadFile ( _
sourceFileName As String, _
address As String, _
userName As String, _
password As String, _
showUI As Boolean, _
connectionTimeout As Integer, _
onUserCancel As UICancelOption _
)
Dim instance As Network
Dim sourceFileName As String
Dim address As String
Dim userName As String
Dim password As String
Dim showUI As Boolean
Dim connectionTimeout As Integer
Dim onUserCancel As UICancelOption
instance.UploadFile(sourceFileName, address, _
userName, password, showUI, connectionTimeout, _
onUserCancel)
public void UploadFile(
string sourceFileName,
string address,
string userName,
string password,
bool showUI,
int connectionTimeout,
UICancelOption onUserCancel
)
public:
void UploadFile(
String^ sourceFileName,
String^ address,
String^ userName,
String^ password,
bool showUI,
int connectionTimeout,
UICancelOption onUserCancel
)
public function UploadFile(
sourceFileName : String,
address : String,
userName : String,
password : String,
showUI : boolean,
connectionTimeout : int,
onUserCancel : UICancelOption
)
For more detailed information, see the Visual Basic topic My.Computer.Network.UploadFile Method.
If showUI is set to True, a dialog box shows the progress of the operation and includes a Cancel button that the user can click to cancel the operation. Because the dialog box is not modal, it does not block user input to other windows in the program.
If the server does not respond within the interval specified in connectionTimeout, the operation is cancelled and an exception is thrown.
My.Computer.Network.UploadFile outputs trace information when you enable network tracing in your application. For more information, see Enabling Network Tracing.
Security Note: |
|---|
The FTP protocol sends information, including passwords, in plain text and should not be used for transmitting sensitive information. |
The following table lists an example of a task involving the My.Computer.Network.UploadFile method.
This example uploads the file Order.txt to http://www.cohowinery.com/uploads.
My.Computer.Network.UploadFile ( "C:\My Documents\Order.txt", _
"http://www.cohowinery.com/upload.aspx")
This example uploads the file Order.txt to http://www.cohowinery.com/uploads without supplying a user name or password, shows the progress of the upload, and has a time-out interval of 500 milliseconds.
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", _
"http://www.cohowinery.com/upload.aspx","","",True,500)
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference
Other Resources