php - Saving file into a prespecified directory using FPDF -


i want save pdf file user specified directory. using fpdf. , code below:

<?php //echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.train2invest.net/useradmin/atest_khan.php\">"; require('fpdf.php');  //create fpdf object $pdf=new fpdf();  //set font entire document $pdf->setfont('times','',12); $pdf->settextcolor(50,60,100);  //set page $pdf->addpage('p'); $pdf->setdisplaymode(real,'default');  //set x , y position main text, reduce font size , write content $pdf->setxy (10,60); $pdf->setfontsize(12); $pdf->write(5,'dear ms.xyx');   $filename="test.pdf"; //output document $dir = "/g:/pdf/test.pdf/"; // full path c:/xampp/htdocs/file/file/ $pdf->output($dir.$filename,'f'); ?> 

now if put "g:\pdf\" in filename doesn't save it!! have tried following:

$filename="g:\pdf\test.pdf"; $pdf->output($filename.'.pdf','f');   $filename="g:\\pdf\\test.pdf"; $pdf->output($filename.'.pdf','f');  $filename="g:/pdf/test.pdf"; $pdf->output($filename.'.pdf','f');   $filename="/g:/pdf/test.pdf/"; $pdf->output($filename.'.pdf','f'); 

i have checked directory trying write has write/read permission , it's there. still doesn't work!

please somebody...

you using f option incorrectly, f designed save pdf locally on server not in specific directory on users machine. use like:

$filename="/home/user/public_html/test.pdf"; $pdf->output($filename,'f'); 

this save in in public_html directory of webserver


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -