function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nagaraju GorliNagaraju Gorli 

How to upload image to static resource from vf page?

HI , 
I need to uploade image in to static resource through visualforce page & controller.
Ajit Kumar 19Ajit Kumar 19
Actually you can,t perfor DML operations on static resources so it is not possible, if you try the below code then it will throw an error that DML operations are not allowed on Static resources.

string str;
StaticResource st = new StaticResource();
st.body=blob.toPdf(str);
st.name='abcd';
insert st;

Do select it as a best answer if it helped you.
 
Nitin SharmaNitin Sharma
In VF page use this where Apple is image and create apple name image file in static resourse.
<apex:outputPanel >
<apex:image url="{!URLFOR($Resource.Apple)}"/>
   <apex:outputText value="{!$Label.DESTINATION_RECORD_PAGE_BLOCK_SECTION_ACTION_LABEL}"/>
                        </apex:outputPanel>