public function setErrorCode($error)
{
$codes = array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION);
- if (!in_array($error, $codes)) {
+ if (!\in_array($error, $codes)) {
throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error));
}
$name = $info['basename'];
// copy to a tmp location
- $tmp = sys_get_temp_dir().'/'.sha1(uniqid(mt_rand(), true));
+ $tmp = sys_get_temp_dir().'/'.strtr(substr(base64_encode(hash('sha256', uniqid(mt_rand(), true), true)), 0, 7), '/', '_');
if (array_key_exists('extension', $info)) {
$tmp .= '.'.$info['extension'];
}