You need to sign in to do that
Don't have an account?
dinesh sivalingam
Download a file from a url using apex class
Hi
I have a url which contains xml file, if i click the click the url it will download the file to my local drive, instead of doing it manually i need to achieve this using apex class, i.e. the scheduled apex class download the file from a url and upload it to the custom object.
How to achieve this, anybody have worked this kind of scenario.
thanks
Dinesh
I have a url which contains xml file, if i click the click the url it will download the file to my local drive, instead of doing it manually i need to achieve this using apex class, i.e. the scheduled apex class download the file from a url and upload it to the custom object.
How to achieve this, anybody have worked this kind of scenario.
thanks
Dinesh
If it is free to use by anyone, you can simply do something like this: Remember to add the proper Remote Site Setting (Setup > Security controls > Remote Site Settings > Add your server)
--
May the Force.com be with you!
Hi Dinesh,
Is this worked for you?
its attaching the response as blob and attching to the record. not the content in the URL is attched to the record.
For me, when i click on the URL, a file is download and I need to add the PDF to the record as attachment.
please share your thoughts.
Regards
Sarath M
Pagereference pg = new Pagereference(YOUR_URL);
Blob b = pg.getContentAsPDF();
//Example to save PDF
Attachment att = new Attachment(Name = 'stvm_4', Body = b, ContentType = 'application/pdf', ParentId='Sobject_Id');
Hi,
What if the content is other than pdf like docx, voice recording. How to insert into custom object attachments.
Any help will be appreciated