Op Englesch liesen Editéieren

Deelen iwwer


Network.UploadFile Method

Definition

Sends the specified file to the specified host address.

Overloads

UploadFile(String, String, String, String, Boolean, Int32, UICancelOption)

Sends the specified file to the specified host address.

UploadFile(String, String)

Sends the specified file to the specified host address.

UploadFile(String, Uri)

Sends the specified file to the specified host address.

UploadFile(String, String, String, String)

Sends the specified file to the specified host address.

UploadFile(String, Uri, String, String)

Sends the specified file to the specified host address.

UploadFile(String, Uri, ICredentials, Boolean, Int32)

Sends the specified file to the specified host address.

UploadFile(String, String, String, String, Boolean, Int32)

Sends the specified file to the specified host address.

UploadFile(String, Uri, ICredentials, Boolean, Int32, UICancelOption)

Sends the specified file to the specified host address.

UploadFile(String, Uri, String, String, Boolean, Int32)

Sends the specified file to the specified host address.

UploadFile(String, Uri, String, String, Boolean, Int32, UICancelOption)

Sends the specified file to the specified host address.

UploadFile(String, String, String, String, Boolean, Int32, UICancelOption)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, string address, string userName, string password, bool showUI, int connectionTimeout, Microsoft.VisualBasic.FileIO.UICancelOption onUserCancel);

Parameters

sourceFileName
String

Path and name of file to upload.

address
String

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

showUI
Boolean

Whether to display progress of the operation. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

onUserCancel
UICancelOption

Action to be taken when the user clicks Cancel. Default is ThrowException.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, String)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, string address);

Parameters

sourceFileName
String

Path and name of file to upload.

address
String

URL, IP address, or URI of destination server.

Exceptions

The source file path is not valid.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the default timeout (100 seconds).

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

You can use one of the other overloads of the UploadFile method to provide user credentials or specify a specific timeout value.

My.Computer.Network.UploadFile outputs trace information when you enable network tracing in your application. For more information, see Enabling Network Tracing.

The following table lists an example of a task involving the My.Computer.Network.UploadFile method.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

Exceptions

The source file path is not valid.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the default timeout (100 seconds).

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

You can use one of the other overloads of the UploadFile method to provide user credentials or specify a specific timeout value.

My.Computer.Network.UploadFile outputs trace information when you enable network tracing in your application. For more information, see Enabling Network Tracing.

The following table lists an example of a task involving the My.Computer.Network.UploadFile method.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, String, String, String)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, string address, string userName, string password);

Parameters

sourceFileName
String

Path and name of file to upload.

address
String

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the default timeout (100 seconds).

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

You can use one of the other overloads of the UploadFile method to specify a specific timeout value.

My.Computer.Network.UploadFile outputs trace information when you enable network tracing in your application. For more information, see Enabling Network Tracing.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri, String, String)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address, string userName, string password);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the default timeout (100 seconds).

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

You can use one of the other overloads of the UploadFile method to specify a specific timeout value.

My.Computer.Network.UploadFile outputs trace information when you enable network tracing in your application. For more information, see Enabling Network Tracing.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri, ICredentials, Boolean, Int32)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address, System.Net.ICredentials networkCredentials, bool showUI, int connectionTimeout);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

networkCredentials
ICredentials

Credentials for authentication.

showUI
Boolean

True to display progress of the operation; otherwise False. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, String, String, String, Boolean, Int32)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, string address, string userName, string password, bool showUI, int connectionTimeout);

Parameters

sourceFileName
String

Path and name of file to upload.

address
String

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

showUI
Boolean

True to display progress of the operation; otherwise False. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri, ICredentials, Boolean, Int32, UICancelOption)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address, System.Net.ICredentials networkCredentials, bool showUI, int connectionTimeout, Microsoft.VisualBasic.FileIO.UICancelOption onUserCancel);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

networkCredentials
ICredentials

Credentials for authentication.

showUI
Boolean

True to display progress of the operation; otherwise False. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

onUserCancel
UICancelOption

Action to be taken when the user clicks Cancel. Default is ThrowException.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri, String, String, Boolean, Int32)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address, string userName, string password, bool showUI, int connectionTimeout);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

showUI
Boolean

True to display progress of the operation; otherwise False. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10

UploadFile(String, Uri, String, String, Boolean, Int32, UICancelOption)

Source:
Network.vb
Source:
Network.vb
Source:
Network.vb

Sends the specified file to the specified host address.

C#
public void UploadFile(string sourceFileName, Uri address, string userName, string password, bool showUI, int connectionTimeout, Microsoft.VisualBasic.FileIO.UICancelOption onUserCancel);

Parameters

sourceFileName
String

Path and name of file to upload.

address
Uri

URL, IP address, or URI of destination server.

userName
String

User name to authenticate. Default is an empty string: "".

password
String

Password to authenticate. Default is an empty string: "".

showUI
Boolean

Whether to display progress of the operation. Default is False.

connectionTimeout
Int32

Timeout interval in milliseconds. Default is 100 seconds.

onUserCancel
UICancelOption

Action to be taken when the user clicks Cancel. Default is ThrowException.

Exceptions

connectionTimeout is less than or equal to zero.

address does not include a file name.

User lacks necessary permissions to perform a network operation.

The server does not respond within the specified connectionTimeout.

The request is denied by the target web server.

Examples

This example uploads the file Order.txt to http://www.cohowinery.com/uploads.

VB
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.

VB
My.Computer.Network.UploadFile ("C:\My Documents\Order.txt", 
"http://www.cohowinery.com/upload.aspx","","",True,500)

Remarks

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.

Notiz

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.

To See
Upload a file How to: Upload a File

See also

Applies to

.NET Framework 4.8.1 an aner Versiounen
Produkt Versiounen
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 5, 6, 7, 8, 9, 10