0

I keep getting a T String parse error. I am not sure what I'm missing? Any help would be appreciated!

<?php
$filename = "http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf";

if (file_exists($filename)) {
    echo "<a\href="http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf </a>";
} else {
    echo "The file $filename does not exist";
}
?>

Edited by Dani: Formatting fixed

4
Contributors
8
Replies
13
Views
6 Years
Discussion Span
Last Post by hielo
0

try:

<?php
$filename = "http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf";

if (file_exists($filename)) {
echo '<a href="http://www.empowergroupusa.com/cambiolabs/extension/catalog/files/inspection_886.pdf">PDF</a>';
} else {
echo "The file $filename does not exist";
}
?>

Thanks! I got the error to go away, but the link shows up on the webpage and it is not working. How do I get it to work without exposing the url? Also, I would like to make the part after inspection variable or dynamic so it will change based upon which page is loaded? Thanks so much!

0

I am pretty sure the path for file_exists needs to be relative to the script it's called from. If the script is being run from the root you want:

if(file_exists('/cambiolabs/extension/catalog/files/inspection_886.pdf')) {
//do something
}
0

Also, I would like to make the part after inspection variable or dynamic so it will change based upon which page is loaded?

I have no idea what you are talking about. You need to elaborate!

0

I am pretty sure the path for file_exists needs to be relative to the script it's called from. If the script is being run from the root you want:

if(file_exists('/cambiolabs/extension/catalog/files/inspection_886.pdf')) {
//do something
}

Would fopen() work to open the pdf file in a new window?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.