Class AudioUploader

Description

FileUploader is a class that allows for easy implementation for uploading multiple image or audio files at once.

This class may also upload a single image from a URL

  • author: Michael Dahlke

Located in /classes/AudioUploader.class.php (line 15)

FileUploader
   |
   --AudioUploader
Variable Summary
Method Summary
 boolean audioIsNotEmpty (int $fileSize)
 boolean audioSmallEnoughForUpload (int $fileSize)
 void checkDirectoryStatus ( $folder)
 bool checkIfFileExists (string $filename)
 int countItemsInDirectory (string $folder)
 void createDirectory (string $folder)
 void getFileName ()
 void getFileNameAtIndex ( $index)
 void getFilePath ()
 void getFilePathAtIndex ( $index)
 void getFileType ()
 void getFileTypeAtIndex ( $index)
 boolean isAudio (string $fileType)
 string returnUploadErrorCodeAtIndex (int $index)
 string returnUploadErrorMessageAtIndex (int $index)
 void setErrorLogFilename ( $input)
 void setFileName ( $input)
 void setFilePath ( $input)
 void setFileType ( $input)
 void setMaxUploadSize ( $input)
 void setOriginalFilePath ( $input)
 boolean validateAudio ( $fileName, string $fileSize, string $fileType)
Variables
mixed $allUploadErrorCodes = array() (line 32)
  • access: protected

Redefinition of:
FileUploader::$allUploadErrorCodes
mixed $allUploadErrorMessages = array() (line 31)
  • access: protected

Redefinition of:
FileUploader::$allUploadErrorMessages
mixed $allUploadErrorsLineNumber = array() (line 33)
  • access: protected

Redefinition of:
FileUploader::$allUploadErrorsLineNumber
mixed $errorLogFileName = 'uploaderErrorLog.txt' (line 26)
  • access: protected

Redefinition of:
FileUploader::$errorLogFileName
mixed $numberOfErrors = 0 (line 28)
  • access: protected

Redefinition of:
FileUploader::$numberOfErrors
mixed $numberOfSuccessfulUploads = 0 (line 27)
  • access: protected

Redefinition of:
FileUploader::$numberOfSuccessfulUploads
mixed $userReadableUploadErrorCodes = array() (line 30)
  • access: protected

Redefinition of:
FileUploader::$userReadableUploadErrorCodes
mixed $userReadableUploadErrorMessages = array() (line 29)
  • access: protected

Redefinition of:
FileUploader::$userReadableUploadErrorMessages

Inherited Variables

Inherited from FileUploader

FileUploader::$allowedAudioTypes
FileUploader::$allowedImageTypes
FileUploader::$allUploadErrorsFileName
FileUploader::$fileTypeForUpload
FileUploader::$numberOfAllowedFilesToUpload
FileUploader::$numberOfFilesPerDirectory
FileUploader::$prependToFileName
Methods
audioIsNotEmpty (line 398)

Check that there is indeed an image present throw exception

  • return: returns true/false
  • access: protected
boolean audioIsNotEmpty (int $fileSize)
  • int $fileSize: filesize of an image
audioSmallEnoughForUpload (line 383)

Check to make sure the file isn't over the maximum allowed filesize Max Allowed Filesize: 5MB throw exception

  • return: returns true/false
  • access: protected
boolean audioSmallEnoughForUpload (int $fileSize)
  • int $fileSize: filesize of an image
checkDirectoryStatus (line 311)
  • access: protected
void checkDirectoryStatus ( $folder)
  • $folder

Redefinition of:
FileUploader::checkDirectoryStatus()
checkIfFileExists (line 326)

Check if the uploading file already exists

  • return: return true if file does not exist, false if it does
  • access: public
bool checkIfFileExists (string $filename)
  • string $filename: full filename of the the file to be checked

Redefinition of:
FileUploader::checkIfFileExists()
Check if the uploading file already exists
countItemsInDirectory (line 272)

count items in a folder

  • return: number of items in the directory
  • access: protected
int countItemsInDirectory (string $folder)
  • string $folder: path of the folder you want the item count of

Redefinition of:
FileUploader::countItemsInDirectory()
count items in a folder
createDirectory (line 284)
  • access: protected
void createDirectory (string $folder)
  • string $folder: folder name to be created

Redefinition of:
FileUploader::createDirectory()
getErrorLogFilename (line 119)

*****************************************************************************

* ERROR HANDLING * * *****************************************************************************

  • access: public
void getErrorLogFilename ()

Redefinition of:
FileUploader::getErrorLogFilename()
getFileName (line 38)

Getters and Setters

  • access: public
void getFileName ()
getFileNameAtIndex (line 59)
  • access: public
void getFileNameAtIndex ( $index)
  • $index
getFilePath (line 45)
  • access: public
void getFilePath ()
getFilePathAtIndex (line 62)
  • access: public
void getFilePathAtIndex ( $index)
  • $index
getFileType (line 52)
  • access: public
void getFileType ()

Redefinition of:
FileUploader::getFileType()
getFileTypeAtIndex (line 65)
  • access: public
void getFileTypeAtIndex ( $index)
  • $index
getMaxNumberOfUploadsPerUpload (line 94)
  • access: public
void getMaxNumberOfUploadsPerUpload ()
getMaxUploadSize (line 87)
  • access: public
void getMaxUploadSize ()

Redefinition of:
FileUploader::getMaxUploadSize()
getNumberOfErrorsDuringUpload (line 128)
  • return: the number of errors that occured during upload
  • access: public
int getNumberOfErrorsDuringUpload ()

Redefinition of:
FileUploader::getNumberOfErrorsDuringUpload()
getNumberOfFilesPerDirectory (line 101)
  • access: public
void getNumberOfFilesPerDirectory ()

Redefinition of:
FileUploader::getNumberOfFilesPerDirectory()
getNumberOfSuccessfulUploads (line 108)
  • access: public
void getNumberOfSuccessfulUploads ()

Redefinition of:
FileUploader::getNumberOfSuccessfulUploads()
getOriginalFilePath (line 69)
  • access: public
void getOriginalFilePath ()
isAudio (line 355)

Check to make sure the file is an image throw exception

  • return: returns true/false
  • access: protected
  • example: example not found
boolean isAudio (string $fileType)
  • string $fileType: The file type of an image
returnAllUploadErrorCodes (line 154)
  • return: return all error codes
  • access: public
string returnAllUploadErrorCodes ()

Redefinition of:
FileUploader::returnAllUploadErrorCodes()
returnAllUploadErrorMessages (line 148)
  • return: return all error messages
  • access: public
string returnAllUploadErrorMessages ()

Redefinition of:
FileUploader::returnAllUploadErrorMessages()
returnAllUploadErrorsLineNumber (line 160)
  • return: return all error line numbers
  • access: public
string returnAllUploadErrorsLineNumber ()

Redefinition of:
FileUploader::returnAllUploadErrorsLineNumber()
returnAllUploadErrorsLineNumberAtIndex (line 185)
  • return: a line number at a specific index
  • access: public
string returnAllUploadErrorsLineNumberAtIndex (int $index)
  • int $index: index of desired line number
returnFormattedErrors (line 192)
  • return: returns error messages in a nice format
  • access: public
string returnFormattedErrors ()

Redefinition of:
FileUploader::returnFormattedErrors()
returnUploadErrorCodeAtIndex (line 177)
  • return: an error code at a specific index
  • access: public
string returnUploadErrorCodeAtIndex (int $index)
  • int $index: index of desired error code

Redefinition of:
FileUploader::returnUploadErrorCodeAtIndex()
returnUploadErrorMessageAtIndex (line 169)
  • return: an error message at a specific index
  • access: public
string returnUploadErrorMessageAtIndex (int $index)
  • int $index: index of desired error message

Redefinition of:
FileUploader::returnUploadErrorMessageAtIndex()
returnUserReadableUploadErrorCodes (line 141)
  • return: return error codes that are safe or relevant for a user
  • access: public
string returnUserReadableUploadErrorCodes ()

Redefinition of:
FileUploader::returnUserReadableUploadErrorCodes()
returnUserReadableUploadErrorMessages (line 134)
  • return: error messages that are safe or relevant for a user
  • access: public
string returnUserReadableUploadErrorMessages ()

Redefinition of:
FileUploader::returnUserReadableUploadErrorMessages()
setErrorLogFilename (line 122)
  • access: public
void setErrorLogFilename ( $input)
  • $input

Redefinition of:
FileUploader::setErrorLogFilename()
setFileName (line 41)
  • access: public
void setFileName ( $input)
  • $input
setFilePath (line 48)
  • access: public
void setFilePath ( $input)
  • $input
setFileType (line 55)
  • access: public
void setFileType ( $input)
  • $input

Redefinition of:
FileUploader::setFileType()
setMaxNumberOfUploadsPerUpload (line 97)
  • access: public
void setMaxNumberOfUploadsPerUpload ( $input)
  • $input
setMaxUploadSize (line 90)
  • access: public
void setMaxUploadSize ( $input)
  • $input

Redefinition of:
FileUploader::setMaxUploadSize()
setNumberOfFilesPerDirectory (line 104)
  • access: public
void setNumberOfFilesPerDirectory ( $input)
  • $input

Redefinition of:
FileUploader::setNumberOfFilesPerDirectory()
setOriginalFilePath (line 72)
  • access: public
void setOriginalFilePath ( $input)
  • $input
validateAudio (line 418)

Run the validation tests for the audio

ex. check if it's indeed an audio check if under maximum size Perhaps down the road have a minium size (it is currently at zero)

  • return: returns true if all validations pass or false if any fail
  • access: protected
boolean validateAudio ( $fileName, string $fileSize, string $fileType)
  • string $fileSize: file size of the image to be checked
  • string $fileType: file type of the image to be checked
  • $fileName
writeAllErrorsToLog (line 208)

Write all upload errors to an error log

  • access: protected
void writeAllErrorsToLog ()

Redefinition of:
FileUploader::writeAllErrorsToLog()
Write all upload errors to an error log

Inherited Methods

Inherited From FileUploader

 FileUploader::checkDirectoryStatus()
 FileUploader::checkIfFileExists()
 FileUploader::countItemsInDirectory()
 FileUploader::createDirectory()
 FileUploader::detectFileType()
 FileUploader::fileIsNotEmpty()
 FileUploader::fileSmallEnoughForUpload()
 FileUploader::getErrorLogFilename()
 FileUploader::getFileType()
 FileUploader::getFileTypeForUpload()
 FileUploader::getMaxUploadSize()
 FileUploader::getNumberOfAllowedFilesToUpload()
 FileUploader::getNumberOfErrorsDuringUpload()
 FileUploader::getNumberOfFilesPerDirectory()
 FileUploader::getNumberOfSuccessfulUploads()
 FileUploader::getPrependToFileName()
 FileUploader::inParentDirectory()
 FileUploader::isAcceptableFileType()
 FileUploader::returnAllUploadErrorCodes()
 FileUploader::returnAllUploadErrorMessages()
 FileUploader::returnAllUploadErrorsFileName()
 FileUploader::returnAllUploadErrorsLineNumber()
 FileUploader::returnFormattedErrors()
 FileUploader::returnUploadErrorCodeAtIndex()
 FileUploader::returnUploadErrorFileNameAtIndex()
 FileUploader::returnUploadErrorLineNumberAtIndex()
 FileUploader::returnUploadErrorMessageAtIndex()
 FileUploader::returnUserReadableUploadErrorCodes()
 FileUploader::returnUserReadableUploadErrorMessages()
 FileUploader::setErrorLogFilename()
 FileUploader::setFileType()
 FileUploader::setFileTypeForUpload()
 FileUploader::setMaxUploadSize()
 FileUploader::setNumberOfAllowedFilesToUpload()
 FileUploader::setNumberOfFilesPerDirectory()
 FileUploader::setPrependToFileName()
 FileUploader::validateFile()
 FileUploader::writeAllErrorsToLog()

Documentation generated on Wed, 28 Aug 2013 22:54:19 -0500 by phpDocumentor 1.4.4