CHANGE_FILE_UPLOAD

This commit is contained in:
VENKATESHWARAN 2025-10-28 10:45:20 +05:30
parent 69f8243ac0
commit e45ed19049
2 changed files with 3 additions and 16 deletions

View File

@ -773,7 +773,7 @@ class LeadsController extends BaseController
$multi_file_data = [];
foreach ($files as $index => $value) {
$file_name = file_Upload_with_random_name($value, $uploadFilePath);
$file_name = file_Upload($value, $uploadFilePath);
$multi_file_data[] = [
'file_name' => $file_name,
'docs_name' => $docs_names[$index],
@ -2605,6 +2605,7 @@ class LeadsController extends BaseController
$this->myLogger->logme('error', (' no file found ' . $file_name_with_path));
return ['status' => 'failed', 'message' => 'no file found'];
}
}catch(Exception $e){
$this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
return ['status' => 'fail', 'error' => "File not found / Wrong file"];

View File

@ -57,21 +57,7 @@ if (!function_exists('file_Upload')) {
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
$fileToUpload->move($filepath);
$fileName = $fileToUpload->getName();
$fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName);
return $fileName;
} else {
return "";
}
}
}
if (!function_exists('file_Upload_with_random_name')) {
function file_Upload_with_random_name($fileToUpload, $filepath)
{
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
$fileToUpload->move($filepath);
$fileName = $fileToUpload->getRandomName();
$fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName);
// $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName);
return $fileName;
} else {
return "";