modifica metodo upload_logo
This commit is contained in:
parent
fbe6d0ffc9
commit
e78ea7dc8b
@ -14105,21 +14105,30 @@ namespace ApiPolo.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string basePath = _configuration["Percorsi:PathLogo"];
|
// Percorso base su Linux (già presente nella macchina server)
|
||||||
string publicBaseUrl = _configuration["Percorsi:PublicBaseUrl"];
|
string basePath = "/zucchetti/api/api-vt.poloinformatico.it/app/wwwroot/VIRTU";
|
||||||
|
|
||||||
|
// Cartella azienda, es. "AZI02"
|
||||||
string aziendaFolder = ten2.Trim();
|
string aziendaFolder = ten2.Trim();
|
||||||
string folderPath = Path.Combine(basePath, aziendaFolder);
|
|
||||||
if (!Directory.Exists(folderPath))
|
|
||||||
Directory.CreateDirectory(folderPath);
|
|
||||||
|
|
||||||
|
// Costruisco il percorso completo in modo portabile
|
||||||
|
string folderPath = Path.Combine(basePath, aziendaFolder);
|
||||||
|
|
||||||
|
//// Creo la cartella se non esiste
|
||||||
|
//if (!Directory.Exists(folderPath))
|
||||||
|
// Directory.CreateDirectory(folderPath);
|
||||||
|
|
||||||
|
// Percorso finale del file
|
||||||
string fullPath = Path.Combine(folderPath, file.FileName);
|
string fullPath = Path.Combine(folderPath, file.FileName);
|
||||||
|
|
||||||
|
// Salvo il file fisicamente
|
||||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
{
|
{
|
||||||
await file.CopyToAsync(stream);
|
await file.CopyToAsync(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// URL pubblico (se la cartella è servita via web)
|
||||||
|
string publicBaseUrl = _configuration["Percorsi:PublicBaseUrl"];
|
||||||
string fileUrl = $"{publicBaseUrl}{aziendaFolder}/{file.FileName}";
|
string fileUrl = $"{publicBaseUrl}{aziendaFolder}/{file.FileName}";
|
||||||
|
|
||||||
return Ok(new
|
return Ok(new
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
"Secret": "ByYM000OLlMQG6VVVp1OH7Xzyr7gHuw1qvUC5dcGt3SNM"
|
"Secret": "ByYM000OLlMQG6VVVp1OH7Xzyr7gHuw1qvUC5dcGt3SNM"
|
||||||
},
|
},
|
||||||
"Percorsi": {
|
"Percorsi": {
|
||||||
"PathLogo": "/zucchetti/api/api-vt.poloinformatico.it/app/wwwroot/VIRTU/",
|
"PathLogo": "/zucchetti/api/api-vt.poloinformatico.it/app/wwwroot/VIRTU",
|
||||||
"PublicBaseUrl": "https://api-vt.poloinformatico.it/VIRTU/"
|
"PublicBaseUrl": "https://api-vt.poloinformatico.it/VIRTU/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user