question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Help] Upload file failed with invalid of file upload MimeType

See original GitHub issue

I would like upload a media file such as image, audio file, etc… In postman, I can run the API to upload the file, the details in postman please check screenshots as below. image image

When I transfer postman’s request to karate feature, but fail. My feature file as below.

Feature: test
  
  Background: 
    * url 'http://example.axm'

Scenario: upload file
  Given path 'api/media/save'
  And header Authorization = 'token'
  And multipart field file = read('coverImage.png')
  And multipart field Type = 'image'
  When method post
  Then status 200

error message

response: MimeType of file uploaded is Invalid.

could you advise how I can implement it by Karate for this upload file call?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Jan 11, 2018

@ansonliao I agree that this will be convenient. but for now, I don’t want to maintain a huge list of all possible file-extensions and mappings to mime-types.

1reaction
ptrthomascommented, Jan 4, 2018

In addition to the doc, refer to the demo also: https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/upload/upload.feature

Try this.

And multipart file file = { read: 'coverImage.png', filename: 'coverImage.png', contentType: 'image/jpeg' }
And multipart field Type = 'image'
And multipart field File = '14ebbblah'
And multipart field MimeType = 'image/jpeg'
And multipart field Extension = 'jpg'
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Help] Upload file failed with invalid of file upload MimeType
I would like upload a media file such as image, audio file, etc.. In postman, I can run the API to upload the...
Read more >
"Invalid mime type detected." Error When Trying to Upload a ...
“Invalid mime type detected.” Error When Trying to Upload a PDF File in Joomla's Media Manager · Open the file media.php which is...
Read more >
Uploading MP3 Error Upload failed: Invalid Mime Type
Why is it that I am getting an error: Upload failed: Invalid Mime Type when I upload an MP3 file? .mp3 is in...
Read more >
Invalid MIME type when trying to upload PDF or DOC files
My file upload settings is set to allow all types of files for upload. I'm using freeform with the file upload feature and...
Read more >
php file upload - invalid MIME type? - Stack Overflow
It checks the mime-type (should be audio file) and then uploads it. The type seems to be recognized but it gives an "invalid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found