I use attachment for upload file excel. I use PHPExcel for read that file and store to database like record by line. I saw file uploaded in data/upload folder ( default folder upload ). That file's name like base64 ( 62fdf2008fadc0939 ). I want to get Uri of that file like " data/upload/acb.xls ". How I get it ? Thank u so much.
Announcement
Collapse
No announcement yet.
Upload file Excel and read it.
Collapse
X
-
Originally posted by binhchay View PostI want to get Uri of that file like " data/upload/acb.xls "
PHP Code:use Espo\Entities\Attachment;
// ...
/** @var Attachment|null $attachment */
$attachment = $this->entityManager->getEntity(Attachment::ENTITY_TYPE, $id);
// ... do stuff. e.g. check that attachment exists, check read permissions etc.
$filePath =$this->entityManager->getRepository(Attachment::ENTITY_TYPE)->getFilePath($attachment);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
// ...
Last edited by mozkomor; 08-26-2022, 09:38 AM.
- Likes 2
Comment
Comment