The constructor accepts parameters allowing you to create the object with certain properties populated. You can define the stream, the size of the file, if any error occurred during the upload, the client file name as well as the client media type.
stream - A valid stream for the file (StreamInterface, string)
size - The size of the file
error - An upload error (see the UPLOAD_ERR_*PHP constants)
clientFilename - The name of the uploaded file from the client
clientMediaType - The media type of the uploaded file from the client
Returns the filename sent by the client. You should not trust the value returned by this method. The client could very well send a malicious filename with the intent to corrupt or hack your application. The value returned is the value stored in the name key in the $_FILES array.
Returns the media type sent by the client. You should not trust the value returned by this method. The client could very well send a malicious filename with the intent to corrupt or hack your application. The value returned is the value stored in the type key in the $_FILES array.
Returns the error associated with the uploaded file. The value is PHP’s UPLOAD_ERR_*constants. If the file was uploaded successfully, the method will return UPLOAD_ERR_OK. The value returned is the value stored in the error key in the $_FILES array.
Returns the stream representing the uploaded file. The method returns a StreamInterface instance. The purpose of this method is to allow utilizing native PHP stream functionality to manipulate the file upload, such as stream_copy_to_stream() (though the result will need to be decorated in a native PHP stream wrapper to work with such functions).
Moves the uploaded file to a new location. This method should be used as an alternative to move_uploaded_file(). This method is guaranteed to work in both SAPI and non-SAPI environments.
The parameter $targetPath can be an absolute or relative path. When calling this method, the original file or stream will be removed. As noted above, if this method is called more than once, any subsequent calls will raise a Phalcon\Http\Message\Exception\InvalidArgumentException exception.
The method performs necessary checks internally so that permissions are properly maintained. If you need to to move the file to a stream, you will need to use getStream(), since SAPI operations cannot guarantee writing stream destinations.