Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process media resources as multipart/form-data in OData v4 as sent by sap.ui.unified.FileUploader #21

Open
gregorwolf opened this issue Dec 22, 2019 · 5 comments

Comments

@gregorwolf
Copy link
Contributor

Hello UI5 Experts,

in addition to the issue #20 there is also a problem when using the OData v4 endpoint from an SAPUI5 UI. The control sap.ui.unified.FileUploader uses a HTTP POST and multipart/form-data to upload the file. To switch to the required PUT operation as described here I've used the a CustomFileUploader from Arindam Seth. But also this one uses multipart/form-data. As CAP and UI5 are both created by SAP I would expect that both work together smoothly.

You can replicate the issue by using my example project that can be found at:

https://github.com/gregorwolf/cap-community/tree/master/examples/media-handling

you can get it running by using:

npm run build
npm run deploy
npm run start

Now open http://localhost:4004/ and try to upload a png file. I.e. the one from the srv/tests folder of the project.

After the upload the picture should be displayed in the list below the field. But you will only see a GUID. That is caused due to to fact that simply all body data is stored without parsing. When you run the tests in srv/tests/media.http with the VS Code REST Client you will see the uploaded picture.

Best regards
Gregor

@vobu
Copy link
Contributor

vobu commented Dec 23, 2019

hi, i think i'll grab this use case (ui5 file uploader & cap media handling in #20 ) and utilize it for the upcoming ui5con in belgium.
so please expect some work here until end of jan 2020 - and nothing over xmas and new years :)
merry whatever you in the #cap- and #ui5-community celebrate 🍩🍹🎉🎄
best,
volker

@gregorwolf
Copy link
Contributor Author

Where you able to share something at UI5con Belgium regarding this topic?

@vobu
Copy link
Contributor

vobu commented Mar 9, 2020

yes, I did - and finally got around cleaning it up some: https://github.com/vobu/ui5-cap
will also replace the (your) custom Upload control soon w/ a more streamlined one - and probably also move controls to web components where applicable

@gregorwolf
Copy link
Contributor Author

Great. Have you tried it also for OData V2?

@htammen
Copy link
Contributor

htammen commented Apr 24, 2020

In the case that you didn't check it in the meantime by yourself @gregorwolf. Yes, it does also work with V2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants