AFFile.Upload Method (String, Stream)
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Uploads the Stream to the server with the specified name.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void Upload( string name, Stream stream )
Public Sub Upload ( name As String, stream As Stream ) Dim instance As AFFile Dim name As String Dim stream As Stream instance.Upload(name, stream)
public: void Upload( String^ name, Stream^ stream )
member Upload : name : string * stream : Stream -> unit
Parameters
- name
- Type: SystemString
The name for the file to upload. - stream
- Type: System.IOStream
The Stream for the file to upload.
Remarks
If the Owner has been set and is associated with a PISystem, then the file is uploaded to the server. Otherwise, the Stream will be buffered until the Owner is set to an object associated with a PISystem.
When the file is uploaded, the following properties are automatically updated: Name, Author, ChangeDate, and FileSize. The file is also validated that its size does not exceed the FileMaxLength and that its extension is in the FileAllowedExtensions list of allowed file extensions. These validation settings can be modified using the AFDiag utility.