Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found

Upload files to devices in App Automate

Important: Ability to upload non-media files on devices is available only under Device Cloud Pro, Device Cloud Pro + Visual Cloud and Enterprise plans. For more details, please checkout our pricing page.

App Automate provides preloaded media files on BrowserStack remote devices to test scenarios that require access to files on the device.

Apart from preloaded media files, you can also upload your media or non-media files in App Automate.

In this guide, you’ll learn:

Supported file types and OS version

The following tab lists the supported files types you can upload, and OS version on which you can upload the files.

The following table shows the supported file types and their size to upload for testing:

File Type Maximum file size
Image JPG, JPEG, PNG, GIF, BMP 10 MB
Video MP4, MOV and 3GP 50 MB
Non-media XLS, XLSX, DOC, DOCX, PDF, CSV, TXT 15 MB

The following table shows the supported OS and devices to which you can upload your files for testing:

OS Device OS version
iOS iPhones and iPads v13 and above (Non-media), v10 and above (Image, Video)

Upload your file to BrowserStack

Run the following upload media cURL command to upload your file to BrowserStack servers:

  curl -u "username:accesskey" \
  -X POST "https://api-cloud.browserstack.com/app-automate/upload-media" \
  -F "file=@/path/to/your/file" \
  -F "custom_id=SampleFile"

A sample response for the given cURL command is as follows. It returns the value of the media_url parameter.

{
  "media_url": "media://90c7a8h8dc82308108734e9a46c24d8f01de12881",
  "custom_id": "SampleFile"
}

The file you uploaded will be available in the following folders on the device:

Camera Roll.
The file path to camera roll directory is /private/var/mobile/Media/DCIM/.

App’s directory in the device. The file path is Files app → On My iPhone → App's directory → ‘Custom_Files’ folder created by BrowserStack.

Set uploadMedia parameter when executing build

In the execute build cURL command, set the uploadMedia parameter to the value of the media_url parameter returned in the API response.

The following sample cURL command shows the parameter used to access your uploaded files for testing on iPhone 8 Plus with iOS 11.0:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/v2/build" \
-d '{"uploadMedia": ["media://90c7a8h8dc82308108734e9a46c24d8f01de12881"],
"devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d",
"testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-H "Content-Type: application/json"
Note:
  • The number of file uploads allowed per session is 5.
  • In the case of non-media files, ensure that your iOS app has the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys set to true in the Info.plist file. This is required to make your app’s folder available in the Files app.

Need some help?

If you need any help with this feature, get in touch with us.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle