Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess file on server from web page
    primarykey
    data
    text
    <p>I'm working on a web page that displays a pdf file that needs to be updatable via a (JSF) file upload. My question is, how can I set my webpage up so that this new uploaded file actually takes the place of the old one?</p> <p>I have the file upload working so that an admin user can upload a different pdf file to replace the one currently displayed, sending the pdf to a folder in my tomcat server, with the same filename as the one previously displayed. I did this because I know you can't save the pdf to a resource file within the web application, as these are not dynamically loaded while the application is running. I am using the following HTML to display the pdf: </p> <pre class="lang-html prettyprint-override"><code>&lt;object id="pdf" data="uploads/folder/replaceable.pdf" type="application/pdf" width="100%" height="100%"&gt; &lt;p&gt;It appears you don't have a PDF plugin for this browser. No biggie... you can &lt;a hRef="uploads/folder/replaceable.pdf" onClick="updatePDF();"&gt;click here to download the PDF file.&lt;/a&gt;&lt;/p&gt; &lt;/object&gt; </code></pre> <p>I've seen <a href="https://stackoverflow.com/questions/8885201/uploaded-image-only-available-after-refreshing-the-page">Uploaded image only available after refreshing the page</a> and <a href="https://stackoverflow.com/questions/8516387/how-i-save-and-retrieve-an-image-on-my-server">How I save and retrieve an image on my server in a java webapp</a> and see that this can be accomplished using <code>&lt;Context&gt;</code> tag to retrieve the file similarly to how I have <code>data="uploads/folder/replaceable.pdf"</code>, but I don't know anything about the <code>&lt;Context&gt;</code> tag and haven't been able to get this to work</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload