View upload files on an HTML page

0

I'm developing a Physics Study website, where the Teacher uploads files for student viewing. Except for the url in the database and the file in a folder. I am unable to view the pdf file on the page.

I'm using the iframe tag to view. I have seen many comments that this tag is not appropriate for such use.

<iframe src='http://docs.google.com/gview?url=http://localhost/hammer/<?php $arquivo?>&embedded=true' style='width:600px; height:400px;' frameborder='0'></iframe>

I use the variable $ file to get the url in the database.

Can anyone help me?

    
asked by anonymous 15.06.2017 / 15:33

3 answers

1

If you echo this php <?php $arquivo?> and take into account what our friend Gustavo Castro said " will google can access your file since you are using via localhost? " . It will definitely work.

<?php echo $arquivo ?>

<iframe src='http://docs.google.com/gview?url=<?php echo $arquivo?>&embedded=true' style='width:600px; height:400px;' frameborder='0'></iframe>

[ DEMO ) [1]

  

Use $ file=" http://infolab.stanford.edu/pub/papers/google.pdf ";

in the iframe edited above and see if it works

  

With localhost does not roll

    
15.06.2017 / 16:17
0

will google get access to your file since you are using via localhost? try to place your code in the cloud or elsewhere and check if your files are accessible.
I believe your file is inaccessible.

<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true"
 style="width:600px; height:500px;" frameborder="0">
</iframe>

removed from How to force a PDF to display in browser

    
15.06.2017 / 16:03
0

Hello.

<iframe src='http://docs.google.com/gview?url=http://localhost/hammer/<?php echo $arquivo?>&embedded=true' style='width:600px; height:400px;' frameborder='0'></iframe>

Even adding echo is not right, is it saving my cloud files right?

    
15.06.2017 / 16:56