-
(string) generateFilename ()
Browse code
Generates a random filename for the current file.
returns A random name to represent the current file
-
(string) getExtension ($default)
Browse code
| $default |
The default extension to return if none was given |
Returns the file extension, based on the content type of the file.
returns The extension (with the dot)
-
(string) getExtensionFromType ($type, $default)
Browse code
| $type |
The content type |
| $default |
The default extension to use |
Returns the extension associated with the given content type.
returns The extension (with the dot)
-
(string) getOriginalExtension ($default)
Browse code
| $default |
The default extension to return if none was given |
Returns the original uploaded file name extension.
returns The extension of the uploaded name (with the dot)
-
(string) getOriginalName ()
Browse code
Returns the original file name.
returns The file name
-
Returns the path to use when saving a file with a relative filename.
returns The path to use when saving a file with a relative filename
-
(string) getSavedName ()
Browse code
Returns the path where the file has been saved
returns The path where the file has been saved
-
Returns the size of the uploaded file.
returns The file size
-
(string) getTempName ()
Browse code
Returns the absolute temporary path to the uploaded file.
returns The temporary path
-
Returns the file content type.
returns The content type
-
Returns true if the file has already been saved.
returns true if the file has already been saved, false otherwise
-
(string) save ($file, $fileMode, $create, $dirMode)
Browse code
| $file |
The file path to save the file |
| $fileMode |
The octal mode to use for the new file |
| $create |
Indicates that we should make the directory before moving the file |
| $dirMode |
The octal mode to use when creating the directory |
Saves the uploaded file.
This method can throw exceptions if there is a problem when saving the file.
If you don't pass a file name, it will be generated by the generateFilename method.
This will only work if you have passed a path when initializing this instance.
returns The filename without the $this->path prefix
throws Exception
-
__construct ($originalName, $type, $tempName, $size, $path)
Browse code
| $originalName |
The original file name |
| $type |
The file content type |
| $tempName |
The absolute temporary path to the file |
| $size |
The file size (in bytes) |
| $path |
The path to save the file (optional). |
Constructor.
-
Returns the name of the saved file.