I want to use multiple files in my project. Would I just change the line "formData.append("inpFile", inpFile.files[0])" to "formData.append("inpFile", inpFile.files)"? Then on the PHP file, make a for loop which would go through the files indexes? $File = $_FILES['inpFile']; For example: $FileSize = filesize($File['name'][$i]); // $i = the index of the for loop.
When I press the "upload file" button @6:00 I get "Uncaught ReferenceError: can't access lexical declaration 'formData' before initialization index.html:24EventListener.handleEvent*"
No error now that I installed PHP from homebrew and told VScode where the PHP executables are...now still nothing in uploads, looks like my $_FILES array is null
Nice video! I'm working with Django and I get this error ""415 (Unsupported Media Type)"" I already googled as much as i can and tried different code but without success. Any advice please (?)
please answer this... how does file is sent to server without converting to base64? how does we send it in binary format? doesn't http only support text? thats why we convert it into base64 string format right? pleaseeee explain me...
I want to upload a file to AWS S3 bucket... Can I pass the URL instead of upload.php file location... If not what else can I do can you please tell me?
if someone is getting the same problem u just need to open it as a server and not as localhost ua-cam.com/video/ohkMRA74MB4/v-deo.html see that video use xamp and open 80 port and it should work
It is not working for me. I can check in the chrome developer tool the FormData is there as binary file But the selected picture do not in the uploads directory for some reason. Anyone have any idea what is the reason of this?
@@dcode-software Hello dcode. I tried with angular + Express and connect-multiparty and its working but the file name is becoming a hash like: 2wrty267yw2.pdf. Do you know how can I fix that?
Has anyone implemented this with django backend? Everything follows along accordingly up until setting up the fetch procedure. I have problems 1.) getting the CSRF token and 2.) keep getting a 302 code. Any advice is greatly appreciated!
best and simplest upload js script forever.
Thank you for sharing your knowledge!
Yeah no worries mate
Thank you very much, you helped me a lot
Very well explained
Cheers mate!
thanks mate! You solved one heck of a headache for me!
I want to use multiple files in my project. Would I just change the line "formData.append("inpFile", inpFile.files[0])" to "formData.append("inpFile", inpFile.files)"? Then on the PHP file, make a for loop which would go through the files indexes?
$File = $_FILES['inpFile'];
For example: $FileSize = filesize($File['name'][$i]); // $i = the index of the for loop.
When I press the "upload file" button @6:00 I get "Uncaught ReferenceError: can't access lexical declaration 'formData' before initialization index.html:24EventListener.handleEvent*"
this is so simple i actually feel like its cheating. Thanks for this
it's not working... I write this code just same as you are and set same directory, but I can't received image file in upload, cause they didn't send.
HTTP/1.1 405 Method Not allowed ???
Hey, i am getting the same issue, were you able to resolve it?
I get a 500 Internal Server Error when I click submit and it doesn't upload the file to the folder :(
No error now that I installed PHP from homebrew and told VScode where the PHP executables are...now still nothing in uploads, looks like my $_FILES array is null
I copied this code exactly as written and got a 405 error. Any idea what the problem could be?
Did you figure it out?
Beautiful man
This posts images perfectly, but does anyone else get a weird error where no other code will run inside the event besides the actual fetch post?
How would you create it so that it automatically chooses a certain file type?
Thanks man!! This really working and solved my issue in a minute.
Thank You For This
Hello! When I follow the same image not copied or saved or uploaded into destination folder.
this helped me a lot, thanks for sharing! cheers!
Hello! May I ask you which VS Code them are you using in this video? Looks very nice!
I'm using Roboto Mono as the font and the theme is Min Dark.
Great post, clear and to the point. Just what I needed!
Nice video! I'm working with Django and I get this error ""415 (Unsupported Media Type)"" I already googled as much as i can and tried different code but without success. Any advice please (?)
Thanks man for the video!!!!
please answer this... how does file is sent to server without converting to base64? how does we send it in binary format? doesn't http only support text? thats why we convert it into base64 string format right? pleaseeee explain me...
I want to upload a file to AWS S3 bucket... Can I pass the URL instead of upload.php file location... If not what else can I do can you please tell me?
can we code the upload.php in JS ?? Because i code on shopify and shopify don't accept PHP....
OK but then where is it the file on the server? cannot find it. Good question, right?
bro i got 405 method not allowed can u give some help
if someone is getting the same problem u just need to open it as a server and not as localhost ua-cam.com/video/ohkMRA74MB4/v-deo.html see that video use xamp and open 80 port and it should work
What about uploading BIG files? Making chunks, etc.?
I would have at least mentioned the most important missing part.. the php file it self.
Unfortunately not because this video is about the front end, using JavaScript. It will work for all server side technologies
Which server are you using?
thanks to you!
How can i use that upload file path in javascript?
good job :)
will the php file run even with xammp or wampp server?
Love you :-)
100 working 👏👏👏❤❤
It is not working for me.
I can check in the chrome developer tool the FormData is there as binary file
But the selected picture do not in the uploads directory for some reason.
Anyone have any idea what is the reason of this?
Ok never mind I figured it out.
There was some permission issue when the php file tried to write.
So if i have the name attribute on on the input tag, does it mean i can now avoid using the formdata.append() ?
thanks
Hello dcode I really liked ur video. May I ask you how can I make the code version of upload.php in nodejs?
You can use Express and Multer :)
@@dcode-software Hello dcode. I tried with angular + Express and connect-multiparty and its working but the file name is becoming a hash like: 2wrty267yw2.pdf. Do you know how can I fix that?
I'm getting no errors, and no file is showing up in my uploads folder.
Try an alternative with apps script
ua-cam.com/video/m3Sc7nVLPP8/v-deo.html
Has anyone implemented this with django backend? Everything follows along accordingly up until setting up the fetch procedure. I have problems 1.) getting the CSRF token and 2.) keep getting a 302 code. Any advice is greatly appreciated!
Try an alternative with google apps script
ua-cam.com/video/m3Sc7nVLPP8/v-deo.html
excelente
I get 404. if u could guide me what am I doing wrong
why we must use php again?
perfect
Can you teach how to validate files using javascript?
I'll be doing a video soon on the File API :)
@@dcode-software Thank buddy.
awesome
Mine is getting error 400 : body must contain a valid content
Try making sure your content type is correct