Skip to content

Instantly share code, notes, and snippets.

View amrud's full-sized avatar
🏠
Working from home

Ismi Ammar amrud

🏠
Working from home
View GitHub Profile
@amrud
amrud / CheckAttachmentSize.page
Created March 29, 2016 04:56 — forked from keirbowden/CheckAttachmentSize.page
Visualforce page that checks the size of a file selected for upload
<apex:page standardController="Account" extensions="AddAttachmentExt">
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"/>
<apex:form>
<apex:sectionHeader title="{!Account.name} Attachments" />
<apex:pageBlock mode="maindetail">
<apex:pageBlockSection title="Existing Attachments" columns="1">
<apex:PageBlockTable value="{!Account.Attachments}" var="attach">
<apex:column value="{!attach.Name}" />
<apex:column headerValue="Length (bytes)" value="{!attach.BodyLength}" />
<apex:column headerValue="Owner" value="{!attach.Owner.Name}" />
@amrud
amrud / AddAttachmentExt.cls
Created March 29, 2016 04:56 — forked from keirbowden/AddAttachmentExt.cls
Extension controller to save an attachment associated with a record encapsulated in the standard controller
public with sharing class AddAttachmentExt
{
private ApexPages.StandardController stdCtrl;
public Attachment att {get; set;}
public AddAttachmentExt(ApexPages.StandardController inStd)
{
stdCtrl=inStd;
att=new Attachment();
}