How can i upload a file from my client PC via Apex ? I need it for a test class so i cannot make api callout. I try this but without success
String yourFiles = 'Lets assume this is your binary string of the files';
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'E'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'C:\myPC\Accounts1472.csv'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = 'Accounts1472 '; // Display name of the files
conVer.VersionData = EncodingUtil.base64Decode(yourFiles); // converting your binary string to Blog
insert conVer;
Any suggestions please ?