Node.js File Upload API with Express Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

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

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

    In this tutorial, you will learn how you can upload all types of files to a Node.js REST API server. We'll create several different reusable middlewares for Node.js & Express and we'll learn how to use one HTML input to upload multiple files at the same time. If you are just getting started with Node.js, I recommend my Node.js for Beginners full course found here: th-cam.com/video/f2EqECiTBL8/w-d-xo.html

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

      Hey Dave, you're teaching is incomparable. could please make a Next js full project with nextauth and mongo db

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

    You are my best teacher Gray! Thank's from Turkey :)

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

    I love the perfection side of your videos, on minute 22:32 you make it clear to all of us. Thank you for bringing this professionalism.

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

      You're welcome! I struggle with perfectionism. The reminder at the end of each video is for me as much as everyone else - keep striving for progress (not perfection). A little bit every day :)

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

    i usually fail to follow tutorials, this man is genius!

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

    You tackle the hardest topics that others evade

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

      Thank you! 🙏 You must challenge yourself to grow 💯

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

    This video is simply amazing!! Especially for a beginner coder with about a week of learning. You are so precise and so thorough in explaining each separate section of coding logic in the building of each file and it’s related files. Simply Amazing 🎉

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

    I get so excited now when I see you post a new video! Can't wait to watch this one

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

    Hey Dave,
    Great Course, I've completed ReactJS and JavaScript playlists too from you. Your explanations are crystal clear and to the point.
    Thanks for the great quality content Dave. Have a great day.

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

      Glad you like them and thanks for the kind words! 🙏💯

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

    Im working on a kyc app and i struggled with limiting size of the document upload, now thanks to Dave, ive fixed it.

  • @sudhikrishnana9778
    @sudhikrishnana9778 ปีที่แล้ว +8

    Hey Dave, it would be great if you could make a react frontend form to upload xlsx files (or any other file) like in this video with backend. By the way your react, javascript, node js, css, tailwind courses are top notch, understood all the concepts.

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

    This glued me to a screen till the last seconds.
    Thanks Dave.
    I’ll definitely like to see React at the front end interacting with this api.
    Also,
    How to handle uploading such files to a mongodb or cloudnary service? After sometime.
    Meaning save temporarily to the save then move the files to cloudnary and store image url returned.
    BTW, thanks, you’re such a blessing to us learners

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

      Thank you, Raymond! 🙏 I appreciate the requests!

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

    Dave your teaching approach is really amazing, you're one of the best teacher i've ever had in my life. thank you for sharing such a valuable contents.

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

    This person comes with absolute best example . sir i love your code thank you

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

    Hi Dave, Just now I have completed the video and tried it - its working well. Of course, it took some time for me to understand the concepts. But overall, really interesting - you did not use even axios or any other extras. Especially you have taken additional efforts to show the error messages without any grammatical issues and you have used middleware for validating the files are amazing. You did a great job and its very useful for the users. Thank you so much for your effort.

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

    This is a nice application of using middleware, thank you!
    I think the grammar thing was actually good since it gives the user a very human-like and easy to read feedback.
    I have a suggestion for refactoring. In the file size and file extension middlewares it is easier to get the sizes and extensions with a filter applied to the Object.values array. In fact, we don't need the keys as far as I can tell, and the loop can be replaced by the filter Array method.

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

      Thank you! And that refactor sounds great!! Excellent comment! 💯🙏🚀

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

    What a great video!! 🏆
    Well explained, well done!
    After busting my brain with the issue of file upload in Node for so long, I was so happy to encouter this video.
    Thanks.

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

    Great Video. Text is bold and visible. Explanation is so clear and precise. Excellent delivery.

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

    Hello Dave, Your react tutorials has been a blessing to me... Please was this project ever done in react ?

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

    Great Content! Did you ever make the React File Upload front end video? I am looking to learn how to integrate that.

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

    I just want to say thank you for sharing your knowledge .... I was here looking for a way to show progress of your file upload while it's uploading but this was still nice to watch as always you explain topics in a very clear way that anyone can understand!

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

    I think that message (with "is" and "are" ternaries, etc) is gorgeous. Sometimes I'm too lazy to do that and I feel guilty about that.

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

    I bought paid courses and this guy channel is better. So crazy 😂😂😂😂😂

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

    Dave,
    I want to add my compliments to the many you already have!
    Your instructions are crystal clear and allowed me to implement your solution into my project with very few updates as changing the repository path for uploaded files and saving the metadata to my database.
    I just want to ask you if you have a tutorial on retrieving the files from the server to allow users to open their files.
    Thank you very much!

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

      Thank you for the kind words! I do not have a tutorial specific to downloading files. However, after learning about Node.js with Express, you should be able to implement the response.download method documented here: expressjs.com/en/5x/api.html#res.download

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

    Best video in yt I have ever seen.
    Can u please make a separate video about Multer middleware stored in database like SQL, noSQL with MVC pattern?
    your video is far better then Udemy paid course.
    Appreciate your hard work 🙏

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

      Thank you for the kind words! And great request! I want to do that, too 💯🚀

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

      @@DaveGrayTeachesCode thanks a lot sir I have just done🙏

  • @Why-Ron75
    @Why-Ron75 3 หลายเดือนก่อน

    This is a great tutorial,
    And therefore I'm a new subscriber :)
    Thank you, Dave!
    Having said that, you've mentioned few times along the video that you might share of the client side code for uploading files with React as well.
    Did you end up doing so?
    And if not, will you, please?

  • @ahmad-murery
    @ahmad-murery 2 ปีที่แล้ว

    Happy to see the return of vanilla JS 💪😁 (I don't know why but I always like to get the most out of native tools)
    anyway, we may use for-of loop to shrink this code
    Object.keys(files).foreach(key => {
    files[key].something
    })
    to this:
    for(let file of files){
    file.something
    }
    Thanks Dave

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

      Thanks Ahmad! Yes, complete preference for choice there. Sometimes I use Object.keys() and sometimes for...of. I should probably consistently choose one only 😃

    • @ahmad-murery
      @ahmad-murery 2 ปีที่แล้ว

      @@DaveGrayTeachesCode I use the first thing comes to my mind and can't be consistent even on the same project 🤦‍♂
      anyway, I enjoy finding alternatives it keeps my brain active (if any 😁)

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

    I love this tutorial! How would we modify this if we wanted to store the files in a database like postgreSQL?

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

    i very much enjoyed following along and will be applying my new knowledge to my personal projects. Thank you for this excellent content, Dave.
    P.S. It would be excellent if you could do this using react. I believe you mentioned to let you know in the video.

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

    I'll be so glad if you prepare a video about streams, process, buffers in nodejs, sir :))

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

    You have an amazing content, I believe there will be full node and backend development long video soon 😎😉👍👍👍

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

      Thank you! 🙏 I do have a Node.js full course here: th-cam.com/video/f2EqECiTBL8/w-d-xo.html

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

      @@DaveGrayTeachesCode wow , yes I bookmarked it as well

  • @NOTHING-en2ue
    @NOTHING-en2ue ปีที่แล้ว

    very well tutorial, i used this code in my own project and it worked very well thanks a lot ❤

  • @authenticsailor9808
    @authenticsailor9808 14 วันที่ผ่านมา

    Note: so when you send one file, then req.files.inputname is a single object. When you send two files from one input, then the form sends as an array of objects. So the .mv function must handle that potential difference as I noticed you didn't. Just a heads up for those who wish to consume the files differently to check each req.files.inputname to determine it's an array or a single object

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

    Thanks Dave! Loved it. It would be nice to have a video on uploading photos to a data base like Mongo.

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

    i like how you clearly explain; you got a new subscriber ✌️

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

    Thank you for your video, Dave! Can you also make the video about the download file with express? Please.

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

    Great course! It helped me so much. I have a question, how do you do to paste code from nowhere?

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

      You cannot paste code from nowhere. During a tutorial, I might have another VS Code instance open off screen that I copy something from.

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

    OF course, when I search for the information how to do something. There's have to be Dave Gray video tutorial on how to do it

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

      Thank you for the kind words! 🙏 I'm working on a Typescript series very soon. 🚀

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

    Yes please make tutorial uploading image from react to node express server and store the images in drive using fs 🙏

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

    yes plz make it as a MERN project. love ur videos . keep it up 👌

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

    Thanks Dave what an amazing tutorial 👏
    Appreciate if you can extend the tutorial to cover converting images to base64 string type and then save it to database
    Thanks again.

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

      You're welcome and that's a great request! In the meantime, this tutorial has some of what you are asking for - the base64 part: th-cam.com/video/jEjo9UytpIc/w-d-xo.html

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

    finally a good tutorial on file uploading

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

    Progress over perfection❤

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

    thank you, this is great , perfect timing, I just happen to need this for my current project. Can you not use axios for this or did you just choose fetch randomly for this example? Can you possibly point me in the right direction on what I would need to research if I wanted to implement a crop photo option before upload or maybe it would be after? It would be to use the image for a profile photo but allow the client to crop it so the most important part of the image is displayed in the bubble.

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

      If allowing the client to crop, I would look for a client-side solution - maybe on npmjs.com. I just used fetch, but you could use Axios or other API layer options.

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

    Hi Dave Grey for the next video i would like you to cretae a video that show the way to generate report to PDF and Excel when the user send a request to backend (Express). this content will be very useful for many people (that include me :) )

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

      Thank you for the request! It won't be next, but I'll add it to my request list.

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

    Really good tutorial, thanks! Based on this, is it possible to integrate a progress bar in the frontend?

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

      Last I looked into creating an accurate progress bar, fetch did not support it - but the older XMLHttpRequest did. There may be some npm packages that make it easier. I created a progress bar for image upload in this tutorial: th-cam.com/video/jEjo9UytpIc/w-d-xo.html

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

      @@DaveGrayTeachesCode Yes, thank you. I modified the sendFiles function a little bit, ...
      const sendFiles_xhr = async() => {
      //Object
      const myFiles = document.getElementById('myFiles').files //all files user selected
      const formData = new FormData()
      //Bind file data to the form
      Object.keys(myFiles).forEach(key =>{
      formData.append(myFiles.item(key).name, myFiles.item(key))
      })
      //Send to backend alternative
      var xhr = new XMLHttpRequest();
      xhr.open('post','localhost:3000/upload',true);
      xhr.upload.onprogress = (e) => {
      if(e.lengthComputable)
      {
      var percentage = (e.loaded / e.total) * 100.0;
      console.log("Progress in %", percentage.toFixed(0))
      }
      }
      xhr.onerror = (e) => {
      console.error("Error! No response from server. This may caused by a network error.")
      }
      xhr.onload = () => {
      console.log('XMLHttpRequest transaction completes successfully');
      }
      xhr.onreadystatechange = function() { // Call a function when the state changes.
      console.log("Ready with status", this.status," ", this.responseText);
      if(this.responseText.length==0)
      {
      console.log("No Response text!")
      return;
      }

      let json = JSON.parse(this.responseText);
      console.log("Response message is: ",json?.message);
      const h2 = document.querySelector('h2')
      h2.textContent = `Status: ${json?.status}`
      const h3 = document.querySelector('h3')
      h3.textContent = json?.message
      if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
      // Request finished. Do processing here.
      }
      }
      xhr.send(formData);
      }

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

    Another great video Dave, Thanks!

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

    Hey Dave,
    awesome tutorial , can you please tell me how I can change the path of saved files meaning if I want to save somewhere else and divide them into different folders like image files separated from doc files.

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

      In that case, you would need to look at the file extension and create the save path based on that information. Notice how I used path.join() to create the paths. If you aren't too familiar with Node.js, starting with my Node.js course would really help out: th-cam.com/video/f2EqECiTBL8/w-d-xo.html

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

    Thanks for creating this video it really help

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

    Thanks Dave, love your tutorial!
    I was trying to use an external script for the javascript but it's not working even after using the same code.
    What might be the issue?

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

      I have no idea. I did not use an external script in this tutorial. I do not know anything about the script you are trying to use, and I cannot see your code. No way I could know the answer. Consider joining my Discord where you can share your code and myself and others can answer questions: discord.gg/neKghyefqh

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

      @@DaveGrayTeachesCode alright thanks,I will join the link now

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

    Thanks for the tutorial!
    Btw what extension or setting are you using for highlighting syntax? I noticed that in your editor the opening and closing brackets are connected with a line (not just highlighted) which would be awesome.

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

      I explain how to add the lines here: th-cam.com/users/shortsMDaxWffMjrQ

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

    can you show the same using react as frontend ...Thanks

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

    Hi Dave, do you have a course on Udemy?

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

      I do not. I do plan to release a premium course at some point. I won't put it on Udemy though.

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

    Dave you can create React JS for this file upload

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

    perfectly explained

  • @Evan-Lab
    @Evan-Lab 2 ปีที่แล้ว

    Thank you very much you help me so much with this video

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

    Thank you so much. i have been looking video on file upload

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

      If you would make a react video on it, then please do try to make little change to backend code as well for duplicate name files. We should try to name incoming files something different so they may not get overwritten

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

      Thank you!

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

      You can add that option if you wish. Check if the file exists on the server and rename the upload before saving if it does.

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

    Thank you very much! It is really helpful!

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

    could you please make a video on websocket

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

    This is some cool asynchronous upload handling script. Creating formdata object and passing into fetch with await wrapped into async function and then taking resolve in json format with optional chaining. That’s really cool, but why express-fileupload and not Multer as an middleware?

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

      Often more than one choice of middleware will meet the requirements you need. All I needed was express-fileupload. I have had other requests for a multer example and can do one this year.

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

      @@DaveGrayTeachesCode I would be definitely interested. All the best.

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

    Thanks Dave.

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

    Hey Dave, could you please make a sample tuto for a file upload using GraphQL mutation (file within variables e.g. queryInput: {firstname, lastname, image} ) thanks

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

    very interesting material, permission to ask, how to upload this file consumed by api gateway? does the api gateway also have to have a multer and a storage folder? thanks

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

      This tutorial uploads a file to an API. It also stores the file on the server. Using multer is another approach that differs from this video.

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

      @@DaveGrayTeachesCode thank you for replying to my comment. i've used multer in my api gateway but i only managed to send the file into the api gateway folder not in the parent API/service I'm calling. do you have turorial for this? Thank you

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

      @@chandrawardhana5884 I do not currently. It sounds like you want to relay the image from your backend API to a 3rd party API. It is possible.

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

      @@DaveGrayTeachesCode more precisely I want to send an excel file to a certain service using the api gateway that I have created. the gateway api is only an intermediary

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

    All of the file upload tutorials I've seen other than this one seem to use multer. Do you prefer this method instead of multer?

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

      No preference, but I just used this one at the time.

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

    Hey thanks for this! Can I upload csv file and convert it to JSON or object?

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

      This tutorial shows how to upload any file type, but it does not show how to process a CSV or convert it to JSON. That would be a good project! 💯

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

    thanks for best content

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

    loved your video❤

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

    Nice one can you make stripe payment video in node js

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

    Hey Dave,
    any plans of launching a paid course

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

      I do want to. I hope to start building one later this year. 🚀

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

      @@DaveGrayTeachesCode yes please do so make a project based course which is beyond basics ...I am looking forward to buy something from you if its of great value .
      I really appreciate all this free contect thank you for teaching me redux and stuff

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

    can you please do it with react front end

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

    Great tutorial!! Is it possible to upload files by http post request only from postman or others? I need to upload video and photos files from game engine Unity.

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

      Thank you! 💯 It is not mine, but here is a nice short video on how to do that: th-cam.com/video/S7bwkys6D0E/w-d-xo.html

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

    how to rename the file before saving it to the our folder ?

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

    please use react to create the form.

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

    Which theme u r using in vs code?
    Could you please tell me?

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

    How about a tutorial on express.js file upload without using packages like multer or express file upload.

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

      Like this one: th-cam.com/video/jEjo9UytpIc/w-d-xo.html

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

    very useful video

  • @arunkumar-tn5gu
    @arunkumar-tn5gu 2 ปีที่แล้ว

    Could you please do a file upload with react.

  • @moho-z5x
    @moho-z5x 11 หลายเดือนก่อน

    How can i use hls in node js ?

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

    Thanks sir

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

    Hey Dave,
    Great explanations and methods. I’ve been trying to create a React app and do some pre-processing there.
    Scenario 1:
    - I don’t need to store the file, but I need to process csv data. So I validate the file extension, headers, etc. in React and then push the data to the API once the file and data checks out.
    - my struggle with this is providing loading status for multiple files. I use a state array, but doesn’t always re-render the component for some reason until another state change later.
    Scenario 2:
    - uploading jpg files. This video couldn’t have come at a better time!
    - is it better to process the file with express? Or should some preprocessing be done with react?
    In both scenarios I am playing with react-dropzone vs standard input field and button. Appreciate and value your thoughts.

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

      Thanks Christopher! 🙏 Let's look at both:
      #1: Fetch does not provide a loading status. See what npm packages are available for this if any. The loading statuses I've seen are faked. If you find a solid solution, please share. Join my Discord to share with others, too. Link in header of my channel.
      #2: I would process the file after it is received. That doesn't mean with Express, but with whatever npm package you need in the Node.js environment.

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

      @@DaveGrayTeachesCode thanks! I guess the overarching opinion is let the api do the processing work; just use react to quickly validate and send the data and process the response. Correct?
      Also, I wasn’t meaning that I was doing loading status with fetch. Sorry for that confusion. I am ok with async/await. The question is probably better directed on the react tutorial where you talk about managing state and how arrays are handled on state changes. I’ll go back and rewatch.

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

      @@cgolebio correct!

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

    Hi Dave, I'm a little confused about this section:
    Object.keys(myFiles).forEach(key => {
    formData.append(myFiles.item(key).name, myFiles.item(key))
    })
    So I wonder why do you use "myFiles.item(key)" over "myFiles[key]". Is there any difference between them ?

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

      There is a difference. You are referring to the JS in the form of the index.html file. myFiles is a FileList. FileLists have an item() method (MDN: developer.mozilla.org/en-US/docs/Web/API/FileList) so I am calling that method to return a file object. myFiles[key] would be correct if myFiles was a single object, and you wanted to reference the property of the object with that specific key.

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

    What did the semicolon ever do to hurt you? Why don't you show my boy some love );

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

      He was my buddy for years, but I'm trying to break the habit and lose his digits. 😆

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

    Awesome Tutorial +++++++++++++++++++++++++ Thank You

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

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

    take love

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

    👍👍👍👍👍👍👍👍👍👍👍👍

  • @d12-j1e
    @d12-j1e 2 ปีที่แล้ว

    Great tutorial but the entire time I was screaming GET TO THE POINT

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

    thank u wise man

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

    Thank you very much! It is really helpful! Hi Dave, I'm a little confused about how to change and setting the url "localhost:3500" by enviorment setting in index.html
    this section:
    const response=await fetch('localhost:3500/upload',{
    method:'POST',
    body:formData
    })
    Thank you very much!

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

      You would not use an environment variable in an html file. In your Node.js files, you can refer to environment variables with process.env.VARIABLE_NAME_GOES_HERE - I cover this and much more in my Node.js for Beginners course here: th-cam.com/video/f2EqECiTBL8/w-d-xo.html