How to view .pdf file in WordPress? - php

I tried to use Google Doc Embedder by using this code
[gview file="http://localhost/wordpress/wp-content/uploads/2013/07/list.pdf"]
but this error keeps on showing up..
Sorry, we were unable to find the document at the original source. Verify that the document still exists.
You can also try to download the original document by clicking here.
I checked in the directory/path to verify and its still there. So what is the reason that this error keeps on showing up?

Google Docs doesn't have access to your local machine. It will need to be on publicly accessible web server for that to work.

Your file path is wrong. You are pointing to localhost for your server. This is something running on your machine only so google reader would not be able to point to a file on your machine.
You should upload your file to a public server.

You can try even
<iframe src="http://localhost:8080/pdf">
I think there are plugins for iframe in wordpress ,Try it out..

In my Wordpress I use this plugin for Google Docs to embed .pdf
DirtySuds - Embed PDF
Then in the post use this:
[embed width="620" height="600"]http://site.com/file.pdf[/embed]
edit:
You will need live host to upload your .pdf files there.

Related

What are possible reasons that HTML download link is failing?

I created a page for users to download certain files. I used the HTML download link to do this as so:
<a download href="/home/Uploads/someDir/someFile.PNG" >View</a>
This worked fine when I was developing on my laptop with WAMP. When I uploaded the code to our Centos 7 Server it did not work. I changed the Uploads, someDir, and someFile.PNG permissions to 777. I also made sure that the file path was correct. But the when the download link is pressed the file icon at the bottom of the screen says "Failed no file".
Maybe I need to do more with the permissions. I know that the folder that the html file is in has restricted permissions, but I would prefer to keep them that way. I do not know how that could cause an issue.
I am looking for debugging tips/possible causes. At this point I am clueless where to look.
The issue with the download not working is simply due to the fact that the path to your file is wrong. My advice on your root directory which is in most cases is var/www/html, create a folder called say somefoldername and manually upload the file to that folder then change the download link to be
View.
"Failed no file" has nothing to do with permissions. The path to your download file has most likely changed when the files were uploaded to the server. You should manually check to see if the file at
/home/Uploads/someDir/someFile.PNG
actually exists. If not you can change the link accordingly or move the download file to the appropriate location.
Another good alternative to solve this error is to put a dot '.' at the beginning of the url:
<a download href="./someDir/someFile.PNG" >View</a>
This way you will not need to indicate the complete url.
And if in the future the url changes, you won't have to modify the url.
In my case it works perfect, I hope it helps you too.
Just check the directory in which you are trying to fetch the file. Your looking file may be not present in that directory. Otherwise, you are using the correct piece of code.
<a download href="~/home/Uploads/someDir/someFile.PNG" >View</a>

Getting a 404 on images uploaded using FTP in Magento

I have recently installed Magento and am using it for the first time. I am trying to uplaod an image to a folder as the new logo in the heading. When I upload the image using FTP the file uploads successfully but I can’t see it in the folder listing in a browser or on the website or if I visit the url for the image. I get a 404 page instead. Everything is getting cached I believe. I have turned off caching in the back end and cleaned out var/cache folder. This is a new one to me as I wouldn’t ahve thoughts ftp uploading an image would or could be cached? I can’t even change the header image on my website.
Im using the hellowired them as a starting point.
Cheers
Check the permissions on the Images and the directory it is in.
Can you verify that it is in the folder that you have uploaded it too?
Can you view it on server browsing the directories?
Finally check that you have type it correctly as Linux box's are CAPS sensitive, this could be why you can't see it also.
Looks like my host migrated my accounts to another server and I was actually updating the old hosting. Thanks for your help.

Copying Facebook Profile Picture Creates a 0kb Image File

This used to work and now it doesn't on my server. This is kind of a last ditch effort to try to figure out what is going wrong here. I'm simply trying to copy a profile image from Facebook to a folder on my server. Here's the only code I'm using:
file_put_contents("..//images/artist_pictures/artist_216.jpg", file_get_contents("http://graph.facebook.com/553451657/picture?type=large"));
After that runs I get a 0kb image file called artist_216.jpg. Any ideas?
I'm not too good with PHP, but I know that the picture URL you're using is a redirect to another file on Facebook's CDN. I'm guessing you need to somehow resolve the actual location and pull the contents of the redirect.
You need to adjust your php.ini file.
Change allow_url_fopen = Off to allow_url_fopen = on.

Trouble locating images

I'm having trouble with missing images on my server.
I have been developing a site locally using MAMP for a while and now that I have uploaded it to my server the images cannot be found. Firebug tells me "Failed to load the given URL".
The file structure is the exact same as it was locally and the code is also the same.
The php file trying to load the images is in the site's root folder along with the folder "images".
Here is the file structure: images/models/dreadfinsl1.jpg
Here is the page: http://eoghanoloughlin.net/george/index.php
Can anyone help me? It seems like it would be just one of those stupid problems / simple answers but I'm relatively new to this don't have much experience. It was working fine when I was using MAMP.
Looks like your in the /george/ map on the server, and i assume locally u used www/
try /george/images/models/dreadfinsl1.jpg
else you will have to use full path http://eoghanoloughlin.net/george/images/models/dreadfinsl1.jpg
Try to access an image which is in your server with the help of web browser by specifying absolute path of the image....
Like http://eoghanoloughlin.net/images/models/dreadfinsl1.jpg
If you found any image on the browser, try to display the same image on your index page...
I think specifying the file path is being a problem in your application....

How to set the default location of the FCKEditor file browser?

I'm working the the image upload piece of the FCKEditor and I've got the uploading working properly but am stuck with the server file browser.
You can see in the dialog above has a Browse Server button which pops up the following dialog
The problem is that I have no idea which folder the file browser is pointing at.
I've set the UserFilePath and USerFilesAbsolutePath in the PHP connector config.php to control where my image uploads go.
How can I configure the file browser so that it starts off pointing at the same folder where my uploads are going?
Edit
The ImageBrowserURL property is NOT what I'm looking for. That property is used for having the Browser Server button point somewhere other than the default file browser.
My problem is figuring out how to point the default file browser to a specific directory.
Please read this post of mine on FCKeditor forums. Are you having the same problem I had?
Is it this?
ImageBrowserURL
(string) Sets the URL of the page called when the user clicks the "Browse Server" button in the "Image" dialog window.
In this way, you can create your custom Image Browser that is well integrated with your system.
See http://www.clinicaestet.ro/FCKeditor/_docs/contents/012.html
You need to set some config information for the FCKEditor. This is done either in javascript code in your webpage or you can do it in the FCKEditor config file which is located typically in /fckeditor/fckconfig.js file. If you did not install the fckeditor to the typical fckeditor directory, you will need to replace that part of the path with the correct path.
In the fckconfig.js file you need to change the "ImageBrowserURL" setting to whatever you want.
FCKConfig.ImageBrowserURL = '/myfilebrowserpath/browser.php' ;
This is where the dialog will look for your files. Here is a link to FCKEditor documentation on this. I hope that helps.

Categories