Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
723 stars 330 forks source link

Support custom filenames #226

Closed erickjth closed 3 years ago

erickjth commented 3 years ago

Summary

The goal of the update is to allow using a custom file name in the upload request. Sometimes it is useful to use a different name from the original file name.

This update includes some logic in the native code (android/iOS) to use a custom file name at the time of creating the request.

Also, it includes a new setting in the uploader { customFilename: string }. This PR also updates the README file.

Test Plan

What's required for testing (prerequisites)?

Just include the customFilename into the options.

const options = {
  url: 'https://myservice.com/path/to/post',
  path: 'file://path/to/file%20on%20device.png',
  method: 'POST',
  field: 'uploaded_media',
  customFilename: 'new_filename.png',
  type: 'multipart'
}

Compatibility

OS Implemented
iOS
Android