How to Build a File Upload System on AWS with React and a Serverless API | Lambda, S3, API Gateway

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2021
  • This video provides a detailed step by step instruction on how to build a file upload system on AWS with React.js in the frontend and a Serverless API in the backend.
    Support the channel plz 😊: www.buymeacoffee.com/felixyu
    video on how to build a login system/web page: • Build an Authenticatio...
    video on serverless APIs in details: • Build a CRUD Serverles...
    video on API authentication with API keys: • API Authentication via...
    video on how to host a website with a custom domain and HTTPS: • Host a Website on AWS ...
    link to get the s3 bucket policy: jinmeister.com/aws/individual...

ความคิดเห็น • 81

  • @ahnafkhan2589
    @ahnafkhan2589 8 หลายเดือนก่อน

    Thanks for this great tutorial. Exactly what I needed. Really appreciate it.

  • @kmcg101
    @kmcg101 2 ปีที่แล้ว +14

    Important detail you left out that was causing a CORS error for me. When you are building your file-processing-service.js file inside your Lambda function, you call util.buildResponse(200). You left out the 2nd parameter, (200, requestBody). This worked for me

  • @theethicalh3707
    @theethicalh3707 2 ปีที่แล้ว +1

    thaaaaaaank you very much bro for those informations you deserve maanyyy likes

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      Thanks a lot :)

  • @jackiedo2959
    @jackiedo2959 2 ปีที่แล้ว

    Excellent content, keep it up bro

  • @khandoor7228
    @khandoor7228 2 ปีที่แล้ว

    Very nice Felix!

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      tyty

  • @chetancc
    @chetancc ปีที่แล้ว +1

    Hi Felix, Thank you for producing informative content. I request you to create a video tutorial of uploading image on AWS with React, so that it gets resized and displays back on the frontend.
    God bless you.

  • @christopheryongo6113
    @christopheryongo6113 ปีที่แล้ว

    Thanks, this is a gem!

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      Glad that u found it helpful!!

  • @shaziyahasan7775
    @shaziyahasan7775 11 หลายเดือนก่อน

    This works like a charm. Thanks, @FelixYu

    • @FelixYu
      @FelixYu  11 หลายเดือนก่อน

      Glad that u found it helpful mate!!

  • @litaoz
    @litaoz 2 ปีที่แล้ว +1

    Great video!

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      Thanks man!!

  • @nick.swoboda
    @nick.swoboda 2 ปีที่แล้ว +1

    Thank you! This is so helpful!

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      Glad that it helped 👍

  • @shaunflagg1117
    @shaunflagg1117 2 ปีที่แล้ว +4

    Is there a link to the repo? Does this support multiple file uploads?

  • @vipuls123456
    @vipuls123456 ปีที่แล้ว

    I was able to resolve the cors issue. The code needs to be updated to use nodejs18, or select the runtime for nodejs accordingly. But I need help to understand how we can upload images or pdf files, and also how to upload multiple files in this manner.

  • @bahramebrahimi7235
    @bahramebrahimi7235 ปีที่แล้ว

    hello, new that we created the api, how can i use this API in react, in your other video you were using a lambda service, but can we do this without lambda?

  • @risingng4635
    @risingng4635 2 ปีที่แล้ว

    Thanks for the video, i followed your steps it works but the issue was that the uploaded file details was correct in cloudwatch log but in my s3 bucket i have ''${s3Subfolder}/${fileName}' just as in the lambda code. please kindly advice.

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      Make sure u use the back tick symbol not a single quotation mark when u define ${}

  • @abinemugh
    @abinemugh ปีที่แล้ว

    hey this does not work for audio files. can you recommend changes for that

  • @Maximusofff
    @Maximusofff ปีที่แล้ว

    Everything is working well , but the upload action is not happening and I can't able to see the text file in S3 bucket , Need help in this ?

  • @mingyu2780
    @mingyu2780 2 ปีที่แล้ว +4

    not sure if Felix is still active on this channel...anyway, has anyone managed to successfully upload an image to their S3 bucket and be able to download/view it without error? Been trying to troubleshoot this by modifying the lambda function to accept content type "image/jpeg" as well as convert the filecontent to base64 encoding but i keep getting an error message involving the cors header origins....would appreciate any help if anyone has managed to accomplish an image upload. Thanks

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      @mingyu2780 here is another video i have that works for images as well:
      th-cam.com/video/7T5VbMEJStQ/w-d-xo.html

  • @xiaoqizhou7740
    @xiaoqizhou7740 ปีที่แล้ว

    can you provide a link to github repo?

  • @growkids4499
    @growkids4499 2 ปีที่แล้ว +2

    Could you please upload same video for image upload?

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      here is the another video i have that shows how to upload images:
      th-cam.com/video/7T5VbMEJStQ/w-d-xo.html

  • @vivianfu1017
    @vivianfu1017 2 ปีที่แล้ว

    Could you please share the upload file system code?

  • @boywithapurpose6194
    @boywithapurpose6194 หลายเดือนก่อน

    I'm a little lost. I don't know how to access the event body. ( I am new to Javascript and AWS ).

  • @bharathgoud892
    @bharathgoud892 2 ปีที่แล้ว +1

    Can you please provide me source code for this? Thanks in advance

  • @luisantonioloustaunaubauti7312
    @luisantonioloustaunaubauti7312 2 ปีที่แล้ว +3

    Hello. Does this support all file types like images (.jpg or.png)?

    • @user-py1xm2zz6g
      @user-py1xm2zz6g 2 ปีที่แล้ว +1

      I am interested in the same question

    • @lute248
      @lute248 2 ปีที่แล้ว +1

      Just tested on jpg and it appears in the s3 bucket no issue

    • @lute248
      @lute248 2 ปีที่แล้ว +1

      hmm it appears when i download it and tried to view it, the message "it appears that we don't support this file format" and i noticed the value under the metadata value for uploaded image is showing as "application/octet-stream" instead of "image/jpeg" ....is there anything we should change on the lambda function ?

    • @chokeslam1996
      @chokeslam1996 2 ปีที่แล้ว

      @@lute248 any luck getting it to work with other files

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      here is another video i have that shows how to upload images:
      th-cam.com/video/7T5VbMEJStQ/w-d-xo.html

  • @sergiisechka1993
    @sergiisechka1993 ปีที่แล้ว

    Felix...how come you use class component in 2021? anyway thank you for doing it from scratch!

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      Haha I haven’t done frontend work for a long time. What is the trend now??

    • @sergiisechka1993
      @sergiisechka1993 ปีที่แล้ว

      @@FelixYu hey forgot to delete my comment, I really enjoyed your video. Now trend: Functional components since 2018-2019

    • @Blinknone
      @Blinknone ปีที่แล้ว

      @@FelixYu Git Hooks and functional objects..

  • @Zayed411
    @Zayed411 2 หลายเดือนก่อน

    can anyone please tell me from where to get the code at 20:30

  • @user-ng1dk2wr2j
    @user-ng1dk2wr2j 6 หลายเดือนก่อน

    how to upload images ???, please help

  • @lorisdeluca610
    @lorisdeluca610 2 ปีที่แล้ว +1

    When trying to upload I keep on getting "has been blocked by CORS policy No access-control-allow-origin header is present in the requested resource" although I do have them set as "*" in file util.js. What can it be?

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      make sure u have the correct headers in the response in the lambda (23:26 of the video)

    • @kokwaichan3807
      @kokwaichan3807 2 ปีที่แล้ว

      @@FelixYu Hi Felix, i have encountered the same issue with CORS policy Access-Control-Allow-Origin of '*' error. Had redone it and had make sure there is no typo error. But still it's not working. Any idea what had went wrong?

    • @tylersullivan6105
      @tylersullivan6105 2 ปีที่แล้ว

      @@FelixYu - Same issue over here.

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      did u check "Enable API Gateway CORS" in api gateway (14:29 of the video)?

    • @alejandromartindelcampo6468
      @alejandromartindelcampo6468 2 ปีที่แล้ว

      Same issue here :(

  • @AkashBhalla
    @AkashBhalla 2 ปีที่แล้ว

    How can we upload pdf in place of txt file, im trying to upload that the file uploads but when I open it its says --
    Error
    Failed to load PDF document.

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      is that an error from the lambda function or from the react frontend??

    • @AkashBhalla
      @AkashBhalla 2 ปีที่แล้ว

      @@FelixYu I have tried numerous ways, finally going with base64 encoding.But same issue. How can I contact you??

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      @@AkashBhalla hmm converting it to base64 should work....try to follow this and see if it works
      github.com/CODEZ-UP/pdfToBase64/blob/master/src/App.js

    • @AkashBhalla
      @AkashBhalla 2 ปีที่แล้ว

      @@FelixYu thanks

  • @huongnguyen4467
    @huongnguyen4467 หลายเดือนก่อน

    Followed all the steps but still getting an error: "No 'Access-Control-Allow-Origin' header is present on the requested resource." anyone else?

  • @riazahmad5975
    @riazahmad5975 ปีที่แล้ว

    good effert but where is the code ????

  • @dontworryaboutit7752
    @dontworryaboutit7752 2 ปีที่แล้ว

    I'm getting a 400 error when i post to my api, any ideas why?

    • @Canda-fh4xc
      @Canda-fh4xc 2 ปีที่แล้ว

      I had the same issue. As far as I know, status code 404 means either the API path is wrong or there is a typo in the code. What was the problem with your code?

  • @AkashBhalla
    @AkashBhalla 2 ปีที่แล้ว

    Can you please help me in uploading pdf file

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      yes, here is the video that shows how to upload pdf files:
      th-cam.com/video/7T5VbMEJStQ/w-d-xo.html

  • @aliazlanaziz
    @aliazlanaziz 10 หลายเดือนก่อน

    code link plz?

  • @linuxhunter007
    @linuxhunter007 2 ปีที่แล้ว

    it will me more better if you upload all the code on github so that we can test it and this will avoid typo mistake
    please share the source code

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      the source code is already uploaded to my github. link is in the description

    • @ianjheferguevarra4345
      @ianjheferguevarra4345 2 ปีที่แล้ว +1

      @@FelixYu I can't find the github link source code

    • @user-py1xm2zz6g
      @user-py1xm2zz6g 2 ปีที่แล้ว

      @@ianjheferguevarra4345 the same!

    • @Canda-fh4xc
      @Canda-fh4xc 2 ปีที่แล้ว

      ​@@ianjheferguevarra4345
      He removed it from his github

  • @Marky00
    @Marky00 2 ปีที่แล้ว

    how do you remove ------WebKitFormBoundary5xOkojIBpXqoCtdp
    Content-Disposition: form-data; name="demo file"; filename="simple.json"
    Content-Type: application/json from the top of the file with out effecting the rest of the file

    • @FelixYu
      @FelixYu  2 ปีที่แล้ว

      u will need to parse the string in ur code logic

    • @lute248
      @lute248 2 ปีที่แล้ว

      @@FelixYu where’s the link to your repo? I still can’t figure out how to upload the image. The image that gets stored on S3 is still in “application/octet” even when i define the content type in lambda to be image/jpeg I set and I can’t download/open it

    • @FelixYu
      @FelixYu  ปีที่แล้ว

      @@lute248 here is another video i have that shows how to upload images:
      th-cam.com/video/7T5VbMEJStQ/w-d-xo.html

  • @AkroshVtu
    @AkroshVtu ปีที่แล้ว

    its my requist to you to please provide source code plz sir

  • @riazahmad5975
    @riazahmad5975 ปีที่แล้ว

    how the bad behaviour is that we support you through like comment and subscription and you can't share the code...

  • @Canda-fh4xc
    @Canda-fh4xc 2 ปีที่แล้ว

    This video is missing very important information for the AWS side. Incomplete tutorial.

  • @AkroshVtu
    @AkroshVtu ปีที่แล้ว

    provide source code plzzzz