By Skysky - Sat Jun 30, 2018 3:18 pm
- Sat Jun 30, 2018 3:18 pm
#814983
Hello,
I try to save a file uploaded in public folder but I've got an error :FAILED TO OPEN STREAM: NO SUCH FILE OR DIRECTORY
What is the problem?
I try to save a file uploaded in public folder but I've got an error :FAILED TO OPEN STREAM: NO SUCH FILE OR DIRECTORY
What is the problem?
Code: Select all
$fileField = 'file'; //set the Name property of the File control
$taskUID = @@TASK; //set to the ID of the task where the DynaForm is assigned
$stepPosition = 1; //set the Dynaform's step position number in the task (first step is 1, second step is 2, etc)
$caseId = @@APPLICATION; //ID of the current case
//Use ORDER BY APP_DOC_INDEX DESC to get the last file uploaded to the File control
$query = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT
WHERE APP_UID='$caseId' AND APP_DOC_FIELDNAME='$fileField' AND
APP_DOC_STATUS = 'ACTIVE' ORDER BY APP_DOC_INDEX DESC";
$results = executeQuery($query);
$fileId = $results[1]['APP_DOC_UID'];
$fileVersion = $results[1]['DOC_VERSION'];
$d = new AppDocument();
$aFileInfo = $d->load($fileId);
$aData = array(
'imageUrl' => "../cases/cases_ShowDocument?a=$fileId&v=$fileVersion",
'imageFilename' => $aFileInfo["APP_DOC_FILENAME"],
'showImage' => ''
);
$link= $aData['imageUrl'];
$str=str_replace('.', "" ,$link);
$img1='http://localhost/sysworkflow/en/neoclassic'.$str.'';
$destdir = 'C:/Bitnami/processmaker-3.2.1-0/apps/processmaker/htdocs/shared/sites/workflow/public/6665954585b2be2a6b23e34093321670';
$img=file_get_contents($img1);
file_put_contents($destdir.substr($img1, strrpos($img1,'/')), $img);