2

Hello all I am new to codeigniter

I am using fpdf & fpdfi for create and append pdf files.

I have some silly issue as below

when I am sending file path as

$pdfPath="./public/site/userdocuments/sagar/RetData/1.pdf";
$pdf -> setSourceFile($pdfPath);

then it works but when I am trying to make pdf files dynamic as follows

$filename="1.pdf";
$pdfPath="./public/site/userdocuments/sagar/RetData/".$filename;
$pdf -> setSourceFile($pdfPath);

then it throws error as below

InvalidArgumentException: Cannot open http://10.0.11.114:8888/start.spaceParse/public/site/userdocuments/sagar/RetData/1.pdf in /Applications/MAMP/htdocs/start.spaceParse/application/libraries/pdfResources/pdf_parser.php on line 192

I had already researched on it and its related to file not found issue. I cant understand whats the problem with it.

any help appreciated ..

Thanks in advance

Sorry for bad English..

Vikas Kad
  • 1,013
  • 1
  • 18
  • 38

2 Answers2

1

I tried the explode function. Try changing your code to something like this:

$filename="1.pdf";
$newString= explode(".",$filename);
$pdfPath="./public/site/userdocuments/sagar/RetData/".newString[0].".pdf";
Mohan
  • 4,677
  • 7
  • 42
  • 65
  • 2
    What's the sense of that code? It's nearly the same as writing `$pdfPath="./public/site/userdocuments/sagar/RetData/“.$filename;` as in the initial question. The code does exactly nothing useful! – Jan Slabon Oct 10 '15 at 19:53
  • 1
    right that's what i thought, but still don't know why this works and writing the name directly doesn't. – Mohan Aug 29 '16 at 10:05
0

Use a local path instead of an URI.

Your code looks like a local path but the error message "says" something different.

Jan Slabon
  • 4,736
  • 2
  • 14
  • 29