• I have created a form that allows people to upload files (PDF, JPEG) but can not figure out where they are store or how to display them as a link in a blog posting. The “hyperlink” of the file in the database table simply downloads an HTML file that I don’t know what to do with. Can anyone point me to documentation on how to generate a URL for an uploaded PDF? Thanks.

Viewing 15 replies - 1 through 15 (of 30 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    First, I am pushing version 1.8.5 today with support for this.

    Use the [cfdb-html] using the “filelinks” options.

    Thread Starter ArundelMom

    (@arundelmom)

    This is great and works fine, except I think there is an issue with viewing PDF files, which is what we are uploading. Image uploads look great, but the PDFs are just code. Do we need a HTML to PDF converter or something? Thanks so much for all your work!

    Plugin Author Michael Simpson

    (@msimpson)

    You should be able to put in a link to a PDF file. What does your shortcode look like?

    Thread Starter ArundelMom

    (@arundelmom)

    My Shortcode is below, and here is a URL to what it looks like…
    http://www.arundelknights.org/?page_id=368

    [cfdb-html form=”News and Events Submission Form” show=”your-name,Submitted,your-subject,your-message,UploadSupportingPDF,URL,Section” limit=”20″ filelinks=”link” filter=”Submitted=May 12, 2011″ orderby=”Submitted desc”]

    submitted: ${Submitted} by ${your-name} for${Section}
    ${your-subject}

    ${your-message}
    Uploaded file name or URL:${UploadSupportingPDF} ${URL}

    ***

    Also, there seems to be a little bug in the shortcode generator: There seems to be an extra bracket after May 12″

    [cfdb-html form=”My-Form” filter=”Submitted=May 12″][/cfdb-html]

    Thread Starter ArundelMom

    (@arundelmom)

    Wait – really bizzare – the code on the screen of the short code builder actually looks like this: but copies as above…

    [cfdb-html] form=”My-Form” filter=”Submitted=May 12″][/cfdb-html]

    Plugin Author Michael Simpson

    (@msimpson)

    OK, I looked at the page and don’t see any shortcode output so I assume it is there but not outputting anything.

    I suggest stripping it down to the minimum and see if that works, then add in extra stuff step by step.

    So start with
    [cfdb-table form="News and Events Submission Form" limit="20"]
    and see if you get a table.

    Then switch to cfdb-html
    [cfdb-html form="News and Events Submission Form" limit="20"]${Submitted}[/cfdb-html]

    Then keep adding in pieces and check each time to be sure it works. Remember: if the “filter” wrong, you get no results returned.

    I don’t see the bug in the shortcode builder, but I’ll play with it some more to see if I can duplicate it.

    Hi Michael,
    I’m helping ArundelMom with her site.

    The issue is that the file download URL is erroneously appending a .html extension to the pdf file… so when downloaded the file has a name that looks like this: myFile.pdf.html

    Therefore your computer has the wrong file extension and tries to open a pdf format as an html text file, hence the garbled output. If you remove the html extension the file opens file.

    An example download link for one of these files looks like this:

    http://www.arundelknights.org/wp-admin/admin-ajax.php?action=cfdb-file&s=1314741913.6987&form=News+and+Events+Submission+Form&field=UploadSupportingPDF

    Is there some way to alter the URL query string to get the file with a valid name / extension or can the bug in the action be fixed?

    Thanks for your help.

    Plugin Author Michael Simpson

    (@msimpson)

    That is not the expected behavior. Which browser/version are you using? Have your tried other browsers, and do they behave the same way?

    I’m on a Mac (10.6.8). I’ve tested both my laptop and my desktop at work.

    It’s definitely not working in Safari 5.0.5 – always adds the .html extension

    I tried Firefox 6.0.1 and that seems to work to the extent that the file extension is .pdf, however I get strange behavior at the time of the download. In particular, on both my computers, Firefox did not know what application to open the file with (all other times I download a pdf, it opens straight away in Preview). Even stranger was that on one of the computers the “do you want to save this file” window said that the file was an Excel file.

    I suspect that somehow during the file streaming the mime type is set incorrectly.

    Thanks for your help.

    Plugin Author Michael Simpson

    (@msimpson)

    The download mechanism, as it is, will not open the file in the browser. This is because the page sets the “Content-Disposition: attachment” header which most browsers handle by automatically downloading and never opening in the browser itself. The reason for using that header is because the URL to get the file does not end in the file name (since the file lives in the DB, not on the file system) so the browser otherwise would not know what the file is or its file name. Anyway, long story short: that is expected behavior.

    What is not expected (or correct) is a browser tacking on a “.html” extension to the file name. No mime-type is set set in the headers so the browser probably assumes text/html. I’ll see if I can reproduce this and play with trying to set a mime-type header to see if that fixes it.

    Hi Michael,
    Any luck recreating the bug in Safari?
    Thanks

    I also have another question in a separate thread… hoping you can take a look at that one as well

    http://wordpress.org/support/topic/contact-form-7-database-id-for-submission

    Plugin Author Michael Simpson

    (@msimpson)

    I think I have a fix the file link thing corrected and I’ll be releasing version 2.0.2 shortly.

    Nice – works great!

    Hi Michael,

    I am testing out your cool plugin for an application and I can get the file to link to a pdf but not mp3s. Any ideas?

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘Where do I find a URL for uploaded files’ is closed to new replies.