Attachment element
With this WebYep element you can attach arbitrary documents to a web page, offering them for download. The user can upload a file such as a Word document or a PDF. The Attachment element will create a download link (using the document filename) for it. And by clicking on the link, visitors can download the file in their web browser.
The Attachment element code
<?php webyep_attachment("attachment", false, "", 550, 240); // WebYepV2 ?>
Arguments for the function call:
- "Fieldname": A string - the field name for this element.
-
true/false: A boolean - the scope for this element.
true if the element should have the same content on all pages (global).
false if it should have different content on each page it appears on. - URL: Optional supportive image/icon location e.g. (images/artwork-highlighter.png).
- 550, 240: Maximum width and height of the editor window.
Screenshots
A note about forced downloads
WebYep does its best to make sure that browsers really download the document and do not display it directly, which is what they tend to do with some file types (like PDF). Unfortunately not all browsers conform to the relevant internet standards (defined in the HTTP protocol specification) and thus some older web browsers might nevertheless display the document instead of starting a download.
File size
The size of the uploaded file is limited by two parameters:
- The PHP configuration of your provider. The provider running the webserver can set various limits to uploads done via PHP. Usually they are set around 2MB - WebYep tries to figure out that limit and displays it in the file upload window.
- The internet connection speed. If an upload takes too long (due to rate if file size to internet connection speed), the browser or server might interrupt the upload process. What exactly "too long" means, depends on a lot of factors (which browser, which version, which operating system, etc.), but a file size of 1-2MB can be considered safe in most situations. It is also important to note that this limit affects only the upload by the user, not the download done by the visitors.
Also consider that if the user has an older smartphone / tablet device (without a file browser) or has a corporate 'firewall' installed, they may be blocked from uploading any files.
Attributes of the Attachment element
Fieldname
A distinctive name for that element. This name will be displayed in the page in edit mode to give the user a hint on what this elements content stands for and to distinguish the different WebYep elements in a page.
Content
When set to "for this doc only" the elements content is unique for this page - even if another element on a different page has the same name. If set to "for all documents" the content will be the same on all pages for elements of this kind that use the same name.
Modal window size
As the developer you can preset the dimensions of the modal window size.