remove quotes from filename after uploaded a image

This commit is contained in:
Diego Najar 2019-01-11 17:43:37 +01:00
parent ba800b9bd4
commit 2bbf79cde9
3 changed files with 23 additions and 1 deletions

View File

@ -42,6 +42,9 @@ foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) {
)));
}
// Convert URL characters such as spaces or quotes to characters
$filename = urldecode($filename);
// Check file extension
$fileExtension = pathinfo($filename, PATHINFO_EXTENSION);
$fileExtension = Text::lowercase($fileExtension);

View File

@ -87,6 +87,12 @@ class Text {
return $string;
}
// Escape quotes and backslash
public static function escapeQuotes($string)
{
return addslashes($string);
}
public static function startsWith($string, $startString)
{
$length = self::length($startString);
@ -125,9 +131,22 @@ class Text {
return preg_replace("/[\/_|+:!@#$%^&*()'\"<>\\\`}{;=,?\[\]~. -]+/", $replace, $string);
}
public static function removeQuotes($string, $replace='')
{
$remove = array('\''=>$replace, '"'=>$replace);
return self::replaceAssoc($remove, $string);
}
public static function removeLineBreaks($string)
{
return str_replace(array("\r", "\n"), '', $string);
$remove = array("\r"=>'', "\n"=>'');
return self::replaceAssoc($remove, $string);
}
public static function removeSpaces($string, $replace='')
{
$remove = array(' '=>$replace);
return self::replaceAssoc($remove, $string);
}
// Convert unicode characters to utf-8 characters