Code is after following your step's of previous upload issue raised is :-
<?php require_once('init.php'); use Ilovepdf\UnlockTask; //with your credentils $myTask = new UnlockTask('project_public_1c8**','secret_key_f**'); try{ $file = $myTask->addFile('Bt21to27july2019.pdf'); } catch (\Exception $e) { var_dump($e); } ?>
I have already check weather the file exists or not(this return's true).I can open that pdf through simple browser, that means read permissions are enabled.
Code is after following your step's of previous upload issue raised is :-
<?php require_once('init.php'); use Ilovepdf\UnlockTask; //with your credentils $myTask = new UnlockTask('project_public_1c8**','secret_key_f**'); try{ $file = $myTask->addFile('Bt21to27july2019.pdf'); } catch (\Exception $e) { var_dump($e); } ?>
This Returns up as below mentioned :- `C:\xampp\htdocs\pdftest\index.php:43: object(Ilovepdf\Exceptions\UploadException)[4] private 'params' (Ilovepdf\Exceptions\ExtendedException) => null private 'type' (Ilovepdf\Exceptions\ExtendedException) => null protected 'message' => string 'Upload error' (length=12) private 'string' (Exception) => string '' (length=0) protected 'code' => int 0 protected 'file' => string 'C:\xampp\htdocs\pdftest\src\Ilovepdf.php' (length=40) protected 'line' => int 191 private 'trace' (Exception) => array (size=3) 0 => array (size=6) 'file' => string 'C:\xampp\htdocs\pdftest\src\Task.php' (length=36) 'line' => int 191 'function' => string 'sendRequest' (length=11) 'class' => string 'Ilovepdf\Ilovepdf' (length=17) 'type' => string '->' (length=2) 'args' => array (size=3) ... 1 => array (size=6) 'file' => string 'C:\xampp\htdocs\pdftest\src\Task.php' (length=36) 'line' => int 156 'function' => string 'uploadFile' (length=10) 'class' => string 'Ilovepdf\Task' (length=13) 'type' => string '->' (length=2) 'args' => array (size=2) ... 2 => array (size=6) 'file' => string 'C:\xampp\htdocs\pdftest\index.php' (length=33) 'line' => int 41 'function' => string 'addFile' (length=7) 'class' => string 'Ilovepdf\Task' (length=13) 'type' => string '->' (length=2) 'args' => array (size=1) ... private 'previous' (Exception) => null public 'xdebug_message' => string '
Common problems on upload is incorrect file path and read permission on file. Can you check this?
I have already check weather the file exists or not(this return's true).I can open that pdf through simple browser, that means read permissions are enabled.
Php permissions are not the same as user permissions. Can you try to set it to "chmod 777"? (not safe for production, just for test)
I switched to the API and it is Working Great.