Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Uploading Files

Native mobile platforms support a method for uploading a file. You provide a path to the local file to be uploaded, the name or title of the file, and a description. If you know the MIME type, you can specify that as well. The upload method returns a platform-specific request object that can upload the file to the server. When you send this request to the server, the server creates a file with version set to 1.

Use the following methods for the given app type:

App Type Upload Method Signature
Android native
1FileRequests.uploadFile()
1public static RestRequest 
2uploadFile(
3File theFile, 
4String name, 
5String description, 
6String mimeType) 
7throws UnsupportedEncodingException
iOS native
1- requestForUploadFile:
2name:description:mimeType:
1- (SFRestRequest *) 
2requestForUploadFile:(NSData *)data 
3name:(NSString *)name 
4description:(NSString *)description 
5mimeType:(NSString *)mimeType
Hybrid (Android and iOS) N/A N/A