Impossibile caricare immagini in Vtiger per Immagine profilo utente

Per risolvere seguire quanto sotto:

I literally just fixed this issue today. Go to vtlib/Vtiger/Functions.php

Around line 608, might be different I have modified this file a few times, you will see “static function validateImage($file_details) {

replace the entire section with the below code:

static function validateImage($file_details) {
global $app_strings;
$allowedImageFormats = array(‘jpeg’, ‘png’, ‘jpg’, ‘pjpeg’, ‘x-png’, ‘gif’, ‘bmp’);

$mimeTypesList = array_merge($allowedImageFormats, array(‘x-ms-bmp’));//bmp another format
$file_type_details = explode(“/”, $file_details[‘type’]);
$filetype = $file_type_details[‘1’];
if ($filetype) {
$filetype = strtolower($filetype);
}

$saveimage = ‘true’;
if (!in_array($filetype, $allowedImageFormats)) {
$saveimage = ‘false’;
}

//mime type check
$mimeType = mime_content_type($file_details[‘tmp_name’]);
$mimeTypeContents = explode(‘/’, $mimeType);
if (!$file_details[‘size’] || !in_array($mimeTypeContents[1], $mimeTypesList)) {
$saveimage = ‘false’;
}

// Check for php code injection
$imageContents = file_get_contents($file_details[‘tmp_name’]);
if (preg_match(‘/(<\?php?(.*?))/i’, $imageContents) == 1) {
$saveimage = ‘false’;
}
return $saveimage;
}

Your old uploads will still not work, but anything moving forward should work fine.

https://discussions.vtiger.com/discussion/188420/cannot-upload-images-but-can-upload-txt-and-pdf-files-version-7-1