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

Can you give me a case to upload a file? I hope you can give me some ideas, thank you. #1

Open
1103036128 opened this issue Sep 8, 2019 · 11 comments

Comments

@1103036128
Copy link

Can you give me a case to upload a file? I hope you can give me some ideas, thank you.

@1103036128
Copy link
Author

FileUpload file = (FileUpload) route.fileUploads().toArray()[0];

@1103036128
Copy link
Author

I need your help, I hope you can reply, I am using this framework now, thank you very much. @noseka1

@1103036128
Copy link
Author

image
My form-data is response error OK。

@noseka1
Copy link
Owner

noseka1 commented Sep 9, 2019

I am not sure that I understand what you are trying to accomplish. Could you elaborate more on what you are trying to achieve and perhaps I can help. Thanks.

@1103036128
Copy link
Author

The current framework (vertx-lambda-aws) should only support application/json, and I hope the framework will also support uploading files as form-data

@1103036128
Copy link
Author

I want to upload the file as a form, but the current framework doesn't seem to support it @noseka1

@1103036128
Copy link
Author

I used the framework you made in combination with vertx, which has been applied in lambda. The cold startup time is 4s, which is very fast, but now I have encountered the problem that the form cannot upload files. I hope you can help me. Thanks.

@1103036128
Copy link
Author

1103036128 commented Sep 9, 2019

Example:

router.route().handler(BodyHandler.create());
router.post("/some/path/uploads").handler(routingContext -> {
Set uploads = routingContext.fileUploads();
// Do something with uploads....
});

@1103036128
Copy link
Author

If you have time, could you help me see how lambda uploads the file to vertx. Thanks @noseka1

@1103036128
Copy link
Author

1103036128 commented Sep 11, 2019

Example:
Input steam is :
{
"resource": "/{proxy+}",
"path": "/damv1/files/upload",
"httpMethod": "POST",
"headers": {
"Accept": "/",
"Accept-Encoding": "gzip, deflate",
"Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjM4MzU3YmY4LTdkMTItNDgyYi04MmU3LWYzMGQyNjhmODFhZiJ9.eyJkaXNwbGF5bmFtZSI6WyLnrqHnkIblkZgiXSwicm9sZSI6WyJBZG1pbiJdLCJ1c2VyX2lkIjoiNjA2MDAwMDAwMDAwMDAwMDAxIiwibmFtZSI6ImFkbWluIiwiZXhwIjoxNTY4MTIwMTY1fQ.mBLp-sCkeauvmdiWZp_oWAgv3vVAf5ifDzEW67ZK3uRYIfxyKeKWX1rVILF8lemyCGRiHY5729lObzOaG8eRGief1b7EzP8Azr85cuBG1Wxxvq9UcLCCMbsbE9g_UxgoKl_iho2xt3Yvt8PbFpAO3QVLfD561im1VbJtZzfAqahGUBOnqw0z3XW7a0MdxjCC61Tfs9gDQmKpWs5P_W7ZVZ0MhQs5VkZqB9wUiEJzpSzfVgObR2h9aomotzK8W7ib7ZHp0SAgJORmPfXqDGMfE1NMxup4uqjUL-QxBQ2KIvo9FKWq3WI5G1e8-boUO3Ee-vK073jfbJChCyCmYDDr5g",
"Cache-Control": "no-cache",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
"CloudFront-Is-Mobile-Viewer": "false",
"CloudFront-Is-SmartTV-Viewer": "false",
"CloudFront-Is-Tablet-Viewer": "false",
"CloudFront-Viewer-Country": "US",
"Content-Type": "multipart/form-data; boundary=--------------------------985577839826605210418899",
"Host": "dev-api.myazs.com",
"Postman-Token": "e6207b02-3f17-4d85-8193-689291355ca0",
"User-Agent": "PostmanRuntime/7.16.3",
"Via": "1.1 4a55d86b7263f73c6817c7c25d4b3643.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "Z6mLGEMpSBLHI0nPQZXyO_e9UfozCxBqmLXuWEpYNlpV8BShUUl2ew==",
"X-Amzn-Trace-Id": "Root=1-5d77a623-a8839a8afabd02fe8feec43c",
"X-Forwarded-For": "38.121.20.29, 54.239.203.58",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https"
},
"multiValueHeaders": {
"Accept": ["/"],
"Accept-Encoding": ["gzip, deflate"],
"Authorization": ["Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjM4MzU3YmY4LTdkMTItNDgyYi04MmU3LWYzMGQyNjhmODFhZiJ9.eyJkaXNwbGF5bmFtZSI6WyLnrqHnkIblkZgiXSwicm9sZSI6WyJBZG1pbiJdLCJ1c2VyX2lkIjoiNjA2MDAwMDAwMDAwMDAwMDAxIiwibmFtZSI6ImFkbWluIiwiZXhwIjoxNTY4MTIwMTY1fQ.mBLp-sCkeauvmdiWZp_oWAgv3vVAf5ifDzEW67ZK3uRYIfxyKeKWX1rVILF8lemyCGRiHY5729lObzOaG8eRGief1b7EzP8Azr85cuBG1Wxxvq9UcLCCMbsbE9g_UxgoKl_iho2xt3Yvt8PbFpAO3QVLfD561im1VbJtZzfAqahGUBOnqw0z3XW7a0MdxjCC61Tfs9gDQmKpWs5P_W7ZVZ0MhQs5VkZqB9wUiEJzpSzfVgObR2h9aomotzK8W7ib7ZHp0SAgJORmPfXqDGMfE1NMxup4uqjUL-QxBQ2KIvo9FKWq3WI5G1e8-boUO3Ee-vK073jfbJChCyCmYDDr5g"],
"Cache-Control": ["no-cache"],
"CloudFront-Forwarded-Proto": ["https"],
"CloudFront-Is-Desktop-Viewer": ["true"],
"CloudFront-Is-Mobile-Viewer": ["false"],
"CloudFront-Is-SmartTV-Viewer": ["false"],
"CloudFront-Is-Tablet-Viewer": ["false"],
"CloudFront-Viewer-Country": ["US"],
"Content-Type": ["multipart/form-data; boundary=--------------------------985577839826605210418899"],
"Host": ["dev-api.myazs.com"],
"Postman-Token": ["e6207b02-3f17-4d85-8193-689291355ca0"],
"User-Agent": ["PostmanRuntime/7.16.3"],
"Via": ["1.1 4a55d86b7263f73c6817c7c25d4b3643.cloudfront.net (CloudFront)"],
"X-Amz-Cf-Id": ["Z6mLGEMpSBLHI0nPQZXyO_e9UfozCxBqmLXuWEpYNlpV8BShUUl2ew=="],
"X-Amzn-Trace-Id": ["Root=1-5d77a623-a8839a8afabd02fe8feec43c"],
"X-Forwarded-For": ["38.121.20.29, 54.239.203.58"],
"X-Forwarded-Port": ["443"],
"X-Forwarded-Proto": ["https"]
},
"queryStringParameters": {
"kind": "article",
"sourceId": "1231423"
},
"multiValueQueryStringParameters": {
"kind": ["article"],
"sourceId": ["1231423"]
},
"pathParameters": {
"proxy": "files/upload"
},
"stageVariables": null,
"requestContext": {
"resourceId": "xx8qwd",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"extendedRequestId": "fzblfF_FywMF73Q=",
"requestTime": "10/Sep/2019:13:33:23 +0000",
"path": "/damv1/files/upload",
"accountId": "113574030890",
"protocol": "HTTP/1.1",
"stage": "dev",
"domainPrefix": "dev-api",
"requestTimeEpoch": 1568122403179,
"requestId": "5c9b064c-f79a-4054-8692-3337648f4318",
"identity": {
"cognitoIdentityPoolId": null,
"accountId": null,
"cognitoIdentityId": null,
"caller": null,
"sourceIp": "38.121.20.29",
"principalOrgId": null,
"accessKey": null,
"cognitoAuthenticationType": null,
"cognitoAuthenticationProvider": null,
"userArn": null,
"userAgent": "PostmanRuntime/7.16.3",
"user": null
},
"domainName": "dev-api.myazs.com",
"apiId": "gaey8ipth9"
},
"body": "----------------------------985577839826605210418899\r\nContent-Disposition: form-data; name="file"; filename="README.md"\r\nContent-Type: text/markdown\r\n\r\n# az-doc-test\r\n\r\naz 测试文档库\r\n----------------------------985577839826605210418899--\r\n",
"isBase64Encoded": false
}

@1103036128
Copy link
Author

1103036128 commented Sep 11, 2019

I want to get the file from the body, Can you tell me what to do. Thanks @noseka1

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

2 participants