View upload files in an HTML page

Asked

Viewed 1,026 times

0

I’m Developing a Physics Study Site, Where the Teacher Uploads Files for Student Visualization. Saved the url in the database and the file in a folder. I am unable to view the pdf file on the page. inserir a descrição da imagem aqui

I am using the iframe tag to visualize. 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 $file variable to get the url in the database.

Can someone help me?

3 answers

0

Does google know how to access your file since Voce is using via localhost? tries to put your code in the cloud or other location and checks if it is accessible your files.
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>

taken from How to force a PDF to be displayed in the browser

0

If you echo in this php <?php $arquivo?> and take into consideration what our friend Gustavo Castro said "will google can access your file since you are using via localhost? ". It’s sure to 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 above edited iframe and see if it works

With localhost does not roll

  • was the first thing I saw in his code...

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 doesn’t work, it’s like saving my cloud files for sure?

  • It’s what our friend Gustavo Castro said "can google access your file since you’re using it via localhost? ". Of course not.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.