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

Update UploadFile docs to reference using curl for CLI file upload #1041

Closed
Badgerati opened this issue Dec 7, 2022 · 3 comments · Fixed by #1049
Closed

Update UploadFile docs to reference using curl for CLI file upload #1041

Badgerati opened this issue Dec 7, 2022 · 3 comments · Fixed by #1049

Comments

@Badgerati
Copy link
Owner

Update the UploadFIle docs to reference using curl to upload files from the CLI, ie:

curl http://localhost:8080/upload -F name=john -F avatar=@"C:\path\to\some\picture.png"

This will upload the file, as a form, and allow Save-PodeRequestFile to work.

Extra:
Investigate doing the same with Invoke-RestMethod, but it seems it doesn't work properly.

@Badgerati Badgerati added this to the 2.8.0 milestone Dec 7, 2022
@Mxrcon
Copy link

Mxrcon commented Dec 13, 2022

I've been trying to upload files using Invoke-WebRequest method but no success so far... it seems that using -Form @{avatar =Get-Item avatar.png fails and gives server error as the avatar key wasn't provided...

@Badgerati
Copy link
Owner Author

I've updated the UploadFile docs to show how to upload a file using curl, but also Invoke-WebRequest!

I found a gotcha bug with how Invoke-WebRequest sets the form-data boundary, and fixing that now allows it to work 😄

@Mxrcon
Copy link

Mxrcon commented Dec 17, 2022

Very nice! Thank you for this!! I would like to rely on PS as much as possible instead of using other binaries for tests like curl!

How can I check the dev docs instead of main docs? I'd like to keep watching the edge work that you're doing.

I'm waiting for the next release 🚀

@Badgerati Badgerati mentioned this issue Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants