Creates a file in the BFS, based on the input in in the FileInfoUpload 

Filter inputs

NameTypeDescriptionMandatoryAvailable from version
FileInfoUploadFileInfoUploadAn instance of the FileInfoUpload class

Response rows

Available from version
MessageStringThe outcome of the operation ("OK" if everything was correct)
FileIdGuidId of the file created, this id is used when getting file in GetFile()2.24

Code examples

C# example
var client = new BFSServiceReference.bfsapiSoapClient(); var credentials = new BFSServiceReference.Credentials() { UserName = bfsusername, //Username of administrative user in your instance of BFS Password = bfspassword, //Password of the administrative user in your instance of BFS };
// Get information about the file to upload to BFS
FileInfo fInfo = new FileInfo(@"c:\temp\test.txt");

// in real life make sure the length don't exceed the maximum setting (default is 4 MB limit)
long numBytes = fInfo.Length;
double dLen = Convert.ToDouble(fInfo.Length / 1000000);
FileStream fStream = new FileStream(@"c:\temp\test_new.txt",
FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);

// convert the file to a byte array
byte[] data = br.ReadBytes((int)numBytes);
CreateFileRequest oReq = new CreateFileRequest();
oReq.Credentials = credentials;
oReq.identify = bfsidentifier; //Identifier is a unique token for your instance of BFS 
oReq.FileInfoUpload = new FileInfoUpload
ContentType = "text", // choose appropiate content type based on your file
fileBytes = data,
FileName = "test_new.txt", // the name of file as you would like to name it in BFS
Owner = new Guid("xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx"), // The owner of the file,  see GetPersons for reference
Permission = FilePermission.All // Type of permission that should apply to this file (AdminOnly/AdminPartner/All)
CreateFileResponse Rep = client.CreateFile(oReq);
if (oRep.Message == "OK")
Console.Writeline("Upload successful");
Console.Writeline(string.format("Upload not successful: {0}", Rep.Message));

Blog Posts