We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I am attempting to upload a file in a Google Cloud Function via a MultiPart Form Data, however getting the following error:
"message": "Required Body [file] not specified",
I have taken the example code from the documentation:
@Controller("/upload") public class DemoController { @Post(value = "/completed", consumes = MULTIPART_FORM_DATA, produces = TEXT_PLAIN) public HttpResponse<String> uploadCompleted(@Body CompletedFileUpload file) { try { File tempFile = File.createTempFile(file.getFilename(), "temp"); Path path = Paths.get(tempFile.getAbsolutePath()); Files.write(path, file.getBytes()); // return HttpResponse.ok("Uploaded"); } catch (IOException e) { return HttpResponse.badRequest("Upload Failed"); } } }
My curl request is:
curl -X POST http://localhost:8080/upload/completed -F file=@test.txt
I am getting the following error:
"message": "Bad Request", "_links": { "self": { "href": "http://localhost:8080/upload/completed", "templated": false } }, "_embedded": { "errors": [ { "message": "Required Body [file] not specified", "path": "/file" } ] } }
Any tip on how to resolve this would be greatly appreciated.
Many Thanks
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue description
Hi,
I am attempting to upload a file in a Google Cloud Function via a MultiPart Form Data, however getting the following error:
"message": "Required Body [file] not specified",
I have taken the example code from the documentation:
My curl request is:
curl -X POST http://localhost:8080/upload/completed -F file=@test.txt
I am getting the following error:
Any tip on how to resolve this would be greatly appreciated.
Many Thanks
The text was updated successfully, but these errors were encountered: