C# Class UploadExamples.Services.NetworkUploadService

Upload service for storing files locally on the network or server
Inheritance: IUploadService
Exibir arquivo Open project: jasonseney/cloudfiles-encoding-demo

Public Methods

Method Description
CancelUpload ( string fileName ) : void

Cancel the upload and delete the TEMP file

GetFileList ( ) : IEnumerable

Returns a list of the network files

GetFileStream ( string fileName, string path ) : Stream

Get a filestream for a local file on the server

NetworkUploadService ( string uploadLocation, string tempFolderName ) : System

Create a new instance of the network upload service.

StoreFileAdvanced ( string fileName, string path, Stream stream, string parameters, bool firstChunk, bool lastChunk ) : void

Stores the file advanced.

StoreFileAdvanced ( string fileName, string path, byte data, int dataLength, string parameters, bool firstChunk, bool lastChunk ) : void

Receive a chunk of data and store it on disk

Protected Methods

Method Description
DeleteUploadedFile ( string fileName ) : void

Delete an uploaded file

FinishedFileUpload ( string fileName, string parameters ) : void

Do your own stuff here when the file is finished uploading

Private Methods

Method Description
SaveFile ( Stream stream, FileStream fs ) : void

Saves the file.

StoreFile ( string fileName, string path, string parameters, bool firstChunk, bool lastChunk, Action storeAction ) : void

Stores the file using a generic store action for working with a filestream

Method Details

CancelUpload() public method

Cancel the upload and delete the TEMP file
public CancelUpload ( string fileName ) : void
fileName string Name of the file.
return void

DeleteUploadedFile() protected method

Delete an uploaded file
protected DeleteUploadedFile ( string fileName ) : void
fileName string Name of the file.
return void

FinishedFileUpload() protected method

Do your own stuff here when the file is finished uploading
protected FinishedFileUpload ( string fileName, string parameters ) : void
fileName string Name of the file.
parameters string The parameters.
return void

GetFileList() public method

Returns a list of the network files
public GetFileList ( ) : IEnumerable
return IEnumerable

GetFileStream() public method

Get a filestream for a local file on the server
public GetFileStream ( string fileName, string path ) : Stream
fileName string The name of the file to stream back
path string The path
return Stream

NetworkUploadService() public method

Create a new instance of the network upload service.
public NetworkUploadService ( string uploadLocation, string tempFolderName ) : System
uploadLocation string The location to store files locally
tempFolderName string A temporary folder name to use for upload transfer
return System

StoreFileAdvanced() public method

Stores the file advanced.
public StoreFileAdvanced ( string fileName, string path, Stream stream, string parameters, bool firstChunk, bool lastChunk ) : void
fileName string Name of the file.
path string path to save to
stream Stream The stream.
parameters string The parameters.
firstChunk bool if set to true [first chunk].
lastChunk bool if set to true [last chunk].
return void

StoreFileAdvanced() public method

Receive a chunk of data and store it on disk
public StoreFileAdvanced ( string fileName, string path, byte data, int dataLength, string parameters, bool firstChunk, bool lastChunk ) : void
fileName string Name of the file.
path string the path to store the file
data byte The file's data.
dataLength int Length of the data.
parameters string The parameters.
firstChunk bool if set to true [first chunk].
lastChunk bool if set to true [last chunk].
return void