WordPress.org

Ready to get started?Download WordPress

Forums

Cannot link directly to PDF file in media library, only to post (25 posts)

  1. eharris
    Member
    Posted 5 years ago #

    I haven't noticed this on any of my WP sites except the new one I just set up. I'm trying to upload a few files, and right on the front page, I'm putting a link to a PDF file. I upload the file (using the browser uploader, since Flash 10 broke the flash uploader), and for the link type, I choose "Link To File" and insert. When I go to the HTML view, I confirm that the link does point to "http://www.kungfu-silat.com/wp-content/uploads/2008/11/gungfuad.pdf"

    However, as soon as I hit Save, that link changes to "http://www.kungfu-silat.com/home/gungfuad" (the "post" location of the file). If I manually change the URL back and save again, it reverts again upon save.

    The file is present and accessible. I can get to it without any problem by using the direct URL. It's just that WordPress won't let me save that URL in the page. What gives?

  2. eharris
    Member
    Posted 5 years ago #

    I've confirmed that this problem does NOT exist on another WordPress site that I administer. Any clue what might be causing it on this one? Both sites are using WordPress 2.6.3.

    I was able to bypass this problem by manually changing the URL that WordPress entered, and removing the rel="attachment wp-att-114" part of the link. This workaround shouldn't be necessary, though, as it's not on the other site I tested on, where the automated "Link To File" button worked fine.

  3. Kathy Reid
    Member
    Posted 5 years ago #

    Hi there,

    I have also experienced this exact same issue - and removing the 'rel' attribute in the link also served as a workaround - thanks for posting it.

    This bug is not restricted to pdf file types - my case was a Word doc.

    For reference I am using WordPress 2.7 on Linux based hosting.

    Will do some digging and post what I come up with.

    Regards,
    Kathy

  4. Kathy Reid
    Member
    Posted 5 years ago #

    I found this in the bug trac - and it seems to cover what we have identified - and narrows it down to only the 'start' page where you have a static home page being affected (which matches my use case - not sure about yours?)

    http://trac.wordpress.org/ticket/7040

    I have reopened this in Trac.

  5. eharris
    Member
    Posted 5 years ago #

    Yes, this was a file I was trying to link to on my static homepage. I haven't yet tried on 2.7 to see if this bug still exists on my site.

  6. Pac_AW
    Member
    Posted 5 years ago #

    I'm having the same issue. Uploading a pdf puts it in the gallery fine, but there is no active link.
    This occurs on posts, haven't tried on pages.
    We do NOT have a static homepage.
    This has occurred ever since we switched to WP 2.7 using automatic updater.

  7. wjnielsen
    Member
    Posted 5 years ago #

    Any Word on this? It's not just an annoying bug, it is killing the productivity for some of my clients. Is there a plugin that corrects the issue?

  8. tortillasoup
    Member
    Posted 5 years ago #

    I only found about it today after a client of mine stated they were having the same issues. I updated their site as soon as 2.7 was released and they were able to post PDF's to their site. However, as of yesterday they cannot and I have tried this on my personal site and get the same issue. This only occurs when attempting to post to the main page, whether it is static or latest posts. Also noticed the Flash Uploader is broken after installing Flash Player 10. I will continue to do some more searching for a resolution.

  9. kidaz
    Member
    Posted 5 years ago #

    Anyone found a solution to this? I have the same problem. I am running 2.7.1. The PDF is uploaded to media library fine, but is not hyperlinked when you visit the post. It is driving me nuts!!!?

  10. knolly42
    Member
    Posted 5 years ago #

    It was driving me nuts till I found a this http://www.vimeo.com/2427969

    Make sure the link URL is 'file'. For me it was blank initially. By default, prior to 2.7 it would point to the file as soon as you'd uploaded.

    Having set it to file on the last upload I did it now generates the link to the file every time.

    Maybe it remembers your last preference but if you've never set it then I suppose it has nothing to remember...? dunno

  11. virgocurtis
    Member
    Posted 5 years ago #

    Yes, beautiful. Such a simple thing missed before. Everything seems to work great for me now. Thanks all for your work on this!!

  12. swift
    Member
    Posted 5 years ago #

    I just came across this problem too - using a static page as my homepage and trying to link to a PDF file from it. The file is there, but the link gets re-written every time you update the page so that clicking on the link takes you to another page with only the actual file link on it (and that one works fine).

    Like suggested above, taking out the rel attribute worked for me, didn't try the file:// method.

    I'd say this is a bug - someone needs to track it down and squish it! I've added my voice to the Trac ticket...

  13. jamaas
    Member
    Posted 5 years ago #

    I can't make this work either. I don't have any rel attribute in the link code and it still doesn't work!

    Thanks

    Jim

  14. Samuel B
    moderator
    Posted 5 years ago #

    on a private blog I set up I have the pdf's embedded in posts. Folks can then save the file or view it live.

  15. jamaas
    Member
    Posted 5 years ago #

    Thanks Samboll ... I think. Can you build a link from some text in a "Page" and get it to link properly to a pdf file on the host server? I still can't. Can you confirm for me that this is some sort of bug and that is not me doing something silly. I've read, googled, read instructions and watched videos and still can not link to a pdf file from a page in 2.7.1 on a hosted server.
    Thanks

    Jim

  16. Samuel B
    moderator
    Posted 5 years ago #

    I haven't tried linking directly but it seems there must be a problem since so many can't do it.
    My client wanted the embed thing and it works.
    Here is the code:

    <embed src='http://domain.com/images/whatever.pdf' width='425' height='425'</embed></embed>

    You can play with the sizes. I don't particularly like it but some think it's cool.

  17. jamaas
    Member
    Posted 5 years ago #

    Thanks again, showing my ignorance here but does this "images" directory have to be in .public_html directory?

    Jim

  18. Samuel B
    moderator
    Posted 5 years ago #

    you can use any folder - that is just the one I used...but yes it has to be somewhere in public_html as that is the root of your site.

  19. matstillo
    Member
    Posted 5 years ago #

    Going back to the original problem, as wjnielsen says up above, this is a real problem for those of us who have set clients up with WordPress to provide CMS capabilities.

    We're not trying anything too exotic here. All I want is for clients to add pdf links to their home page, and thats it. But they need to be able to do this without having to go into html view, which they cannot do & will not want to do. Is there any progress on the bug trac as this must be affecting quite a few people?

    I can confirm that stripping out the rel attributes does fix it, but I can't expect some of my clients to understand a word of that. They will take one look at the code view & 1) freak out, then 2) probably ruin the whole page. Please can we get this resolved so that they can add these links while staying in the visual mode workflow?

    Cheers!

  20. spaanem
    Member
    Posted 5 years ago #

    Anyone looking for a workaround to this issue, here's how I fixed it:

    Create a file in your theme folder called attachment.php that contains this bit of code: <?php header( 'Location: '.wp_get_attachment_url() ); ?>

    This will immediately redirect the attachment page to the link to the attached file (this will appear seamless for the user).

    Note that this does remove the ability to have attached file pages, though personally I'm not sure why you'd want to link to a page to link to a file to begin with.

  21. morethanthesky
    Member
    Posted 5 years ago #

    Thank you Spaanem!!! You've just made my life a LOT better!!!

  22. liquidcable
    Member
    Posted 5 years ago #

    I having this problem too. Bug #7040 looks to be closed. Any one have an update on this bug getting fixed in the next release.

  23. liquidcable
    Member
    Posted 5 years ago #

    spaanem, I've created the attachment.php file and placed into the theme directory. But it has not fixed the problem.

    The attachment.php file should be in the currently used theme directory correct?

    After I add the file do I need to do anything else before trying it?

  24. liquidcable
    Member
    Posted 5 years ago #

    Ok, had to delete the post and create a new one. And the spaanem work around only appears to work on NEW posts, if you modify a current post then it doesn't work.

    It appears to remove the rel=' portion of the link, thus when posting WordPress does not change it. But this alloy works for new posts.

  25. bill127300
    Member
    Posted 4 years ago #

    What post? I thought we were talking about static home pages in this thread?

Topic Closed

This topic has been closed to new replies.

About this Topic