How to Upload Images with JavaScript ( The Ultimate Guide ) - Node.js - Part #2

  Рет қаралды 7,685

Web Dev Tutorials

Web Dev Tutorials

Күн бұрын

Пікірлер: 21
@rubenreffell262
@rubenreffell262 8 ай бұрын
when i typed in npm init it said there was an error and it couldn't find the string? please help
@timokimo8206
@timokimo8206 2 жыл бұрын
Great video 👍🏼
@codefoxx
@codefoxx 2 жыл бұрын
Thanks 👍
@andriagoodwin1640
@andriagoodwin1640 Жыл бұрын
Hey, thank you so much for the video. It's helping a lot for part of a project I am doing for the bootcamp I'm in. One question, I am getting an error on this line of the JavaScript: "savedImages = JSON.parse('');" It seems to not like the code inside the quotes. I have been googling and googling but I can't seem to find any solution that will fit into the work I've already put into the project. Do you have any ideas of what could be happening or how to fix it? I'd really appreciate it.
@IvanFigueroa-st7zh
@IvanFigueroa-st7zh 10 ай бұрын
Hi Andria, I'm having the same problem. Please let me know if you've found a solution. Thanks in advance.
@lorenzomalvito8895
@lorenzomalvito8895 2 жыл бұрын
i have a big problem... the button are not working, if I click it it doesn't make anything on google chrome with the inspector, when I click the upload button that its: (index):159 Uncaught ReferenceError: Cannot access 'formData' before initialization at sendQueuedImagesToServer ((index):159:34) at HTMLFormElement. ((index):155:17)
@codefoxx
@codefoxx 2 жыл бұрын
That error means your trying to use a variable , in this case, formData, before you initiliazed it. Check the order of the functions and make sure they are in the same order as i have them. Also check if you initiliazed formData at the very beginning of the function as i did
@ahmetkizil818
@ahmetkizil818 2 жыл бұрын
How can I use this example on real server? When I throw it to server, on uploadin give me a message "Error: Not Found"
@codefoxx
@codefoxx 2 жыл бұрын
Did you change the URL to the images coming from the server from localhost:3000 to the URL for your website? If it still doesnt work, your server provider perhaps may not allow access to the file system. For example, when i tried it with cyclic, it didnt let me either. In that case, you will need to wait for part 3 (or figure it out on your own)where i show you how to save the name of the image in a database and the actuall image file in AWS. Its guaranteed to work in a real server that way
@ahmetkizil818
@ahmetkizil818 2 жыл бұрын
@@codefoxx No I didn't change localhost:3000 How can I do it? I dont know!
@ahmetkizil818
@ahmetkizil818 2 жыл бұрын
And I use PHP server. Is it work on my server?
@pixel4229
@pixel4229 Жыл бұрын
If I wanted to have another page on the site with another .html (.ejs i guess) file, how can i send the images from the server to that page instead?
@codefoxx
@codefoxx Жыл бұрын
Easy, create a route for that page in the server.js file. Basically duplicate the first get route on this project but have it point to that page instead. Then in the ejs file for that route, you would display the image to that url instead of the home page. So, if your page was named "about.ejs", for example, you would use http:localhost:5000/about" for the url of the image tag within the displayImages function.
@pixel4229
@pixel4229 Жыл бұрын
@@codefoxx I got it working now! Thank you very much! Great tutorial btw
@pixel4229
@pixel4229 Жыл бұрын
@@codefoxx One more question actually! If i want to add some kind of tags to the images like 'landscape' and stuff like that, do I need a different way of saving or is it possible with this one?
@codefoxx
@codefoxx Жыл бұрын
@@pixel4229 you would have to design it a little differently. You know how all were doing is uploading images? well, you would have to create an input field that allows them to add text as well. You would also need an object instead of an array that holds the images in the frontend, in that case. Or an array with lots of objects inside. You would also need another column in your database to save the tags. So , yea, it complicates stuff a bit but thats part of what youl be dealing with as a programmer
@codefoxx
@codefoxx Жыл бұрын
@@pixel4229 you would need to learn how save images in a database as well. So you actually would need to watch part 3, before you attempted to add tags
@sbgaming6180
@sbgaming6180 Жыл бұрын
Plz make a sneaker monitor for myntra
@TheDanchickPro
@TheDanchickPro Жыл бұрын
good
Node.js File Upload API with Express Tutorial
35:25
Dave Gray
Рет қаралды 69 М.
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
Какой я клей? | CLEX #shorts
0:59
CLEX
Рет қаралды 1,9 МЛН
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
Ping pong game javascript | javascript portfolio course
37:46
Canta Coder
Рет қаралды 2,7 М.
How to Upload Files in Node.js Using Express and Multer
6:52
James Q Quick
Рет қаралды 75 М.
Uploading Images with Multer | NodeJS and ExpressJS
15:34
PedroTech
Рет қаралды 202 М.
Upload Multiple Files using the Fetch API - JavaScript Tutorial
13:33
OpenJavaScript
Рет қаралды 4,1 М.
HTML File Uploads in 5 Minutes (Plus Some JavaScript Features)
12:44
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН