sfValidatedFile represents a validated uploaded file.
Method Summary
-
string
getExtension($default)
Returns the file extension, based on the content type of the file.
-
string
getExtensionFromType($type, $default)
Returns the extension associated with the given content type.
-
string
getOriginalExtension($default)
Returns the original uploaded file name extension.
-
string
getOriginalName()
Returns the original file name.
-
string
getSavedName()
Returns the path where the file has been saved
-
int
getSize()
Returns the size of the uploaded file.
-
string
getTempName()
Returns the absolute temporary path to the uploaded file.
-
string
getType()
Returns the file content type.
-
Boolean
isSaved()
Returns true if the file has already been saved.
-
bool
save($file, $fileMode, $create, $dirMode)
Saves the uploaded file.
-
__construct($originalName, $type, $tempName, $size)
Constructor.
-
__toString()
Returns the name of the saved file.
Method Details
-
(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
-
(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
-
(bool) save ($file, $fileMode, $create, $dirMode)
Browse code
| $file |
The absolute 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.
returns true, if the file was saved, otherwise false
throws Exception
-
__construct ($originalName, $type, $tempName, $size)
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) |
Constructor.
-
Returns the name of the saved file.
|