Interface IBizFormFileService
- Namespace
- CMS.OnlineForms
- Assembly
- CMS.OnlineForms.dll
Defines manipulation methods for a file uploaded via forms.
public interface IBizFormFileService
- Extension Methods
Methods
DeleteFile(string, string)
Deletes file previously saved via the PromoteTempFile(string, string, string, string) method.
void DeleteFile(string fileName, string filesFolderPath)
Parameters
fileNamestringFile name to be used for the file.
filesFolderPathstringFolder path where uploaded form files are being saved.
Exceptions
- ArgumentException
Thrown when
fileNameorfilesFolderPathis null or an empty string.
DeleteTempFile(string, string)
Deletes temporary file previously saved via the SaveUploadedFileAsTempFile(IUploadedFile, string, string, int, int, int) method which was not promoted to a permanent file.
void DeleteTempFile(string tempFileIdentifier, string tempFilesFolderPath)
Parameters
tempFileIdentifierstringIdentifier of the temporary file to derive file name from.
tempFilesFolderPathstringFolder path where temporary files are being saved.
Exceptions
- ArgumentException
Thrown when
tempFileIdentifierortempFilesFolderPathis null or an empty string.
GetTempFileName(string)
Gets temporary file name for an identifier.
string GetTempFileName(string tempFileIdentifier)
Parameters
tempFileIdentifierstringIdentifier of the temporary file to derive file name from.
Returns
- string
Returns the temporary file name based on
tempFileIdentifier.
Exceptions
- ArgumentException
Thrown when
tempFileIdentifieris null or an empty string.
PromoteTempFile(string, string, string, string)
Saves temporary file previously saved via the SaveUploadedFileAsTempFile(IUploadedFile, string, string, int, int, int) method as a permanent form file.
void PromoteTempFile(string tempFileIdentifier, string tempFilesFolderPath, string fileName, string filesFolderPath)
Parameters
tempFileIdentifierstringIdentifier of the temporary file to derive file name from.
tempFilesFolderPathstringFolder path where temporary files are being saved.
fileNamestringFile name to be used for temporary file.
filesFolderPathstringFolder path where uploaded form files are being saved.
Exceptions
- ArgumentException
Thrown when
tempFileIdentifier,tempFilesFolderPath,fileNameorfilesFolderPathis null or an empty string.
SaveUploadedFileAsTempFile(IUploadedFile, string, string, int, int, int)
Saves uploaded form file as a temporary file to the file system. The file can be optionally resized if it is an image file.
The type of the file is determined from the uploadedFile's FileName.
void SaveUploadedFileAsTempFile(IUploadedFile uploadedFile, string tempFileIdentifier, string tempFilesFolderPath, int width, int height, int maxSideSize)
Parameters
uploadedFileIUploadedFilePosted file from a client.
tempFileIdentifierstringIdentifier of the temporary file to derive file name from.
tempFilesFolderPathstringFolder path where temporary form files are being saved.
widthintRequired image width to resize the
uploadedFileto if the file is an image file, or 0.heightintRequired image height to resize the
uploadedFileto if the file is an image file, or 0.maxSideSizeintRequired image max side size to resize the
uploadedFileto if the file is an image file, or 0.
Exceptions
- ArgumentNullException
Thrown when
uploadedFileis null.- ArgumentException
Thrown when
tempFileIdentifierortempFilesFolderPathis null or an empty string.
TempFileExists(string, string)
Checks whether file previously saved via the SaveUploadedFileAsTempFile(IUploadedFile, string, string, int, int, int) still exists.
bool TempFileExists(string tempFileIdentifier, string tempFilesFolderPath)
Parameters
tempFileIdentifierstringIdentifier of the temporary file to derive file name from.
tempFilesFolderPathstringFolder path where temporary files are being saved.
Returns
- bool
True if the file exists, otherwise false.