Это видео недоступно.
Сожалеем об этом.

HTML5 Drag and Drop Uploading

Поделиться
HTML-код
  • Опубликовано: 27 апр 2014
  • Want more? Explore the library at www.codecourse...
    Official site
    www.codecourse...
    Twitter
    / teamcodecourse

Комментарии • 119

  • @webdeveloperify
    @webdeveloperify 9 лет назад +13

    Hi Alex, I am following you when i was in college and because of you I am now a good web developer. Each tutorial made by you is very precise and exposes a great learning to a new technology. Thanks for all your efforts.

    • @codecourse
      @codecourse  9 лет назад +12

      webdeveloperify I love comments like this. You're more than welcome, and I hope our videos continue to inspire you!

  • @stevenhoogslag
    @stevenhoogslag 8 лет назад

    This tutorial boosted my knowledge of AJAX, JSON, PHP, CSS, HTML, file upload and the inspection feature in IE and Chrome.

  • @djkrazay7791
    @djkrazay7791 4 года назад

    Way to go.. I have gone thru lots of drag and drop tutorials.. yours is supreme as you explain each step. Thank you!

  • @arturataide7660
    @arturataide7660 10 лет назад

    i'm my project report I have to leave a space to thank you and your tutorials. My computer science final project is more interactive with your help, and for that reason I bought your book :D Thanks Alex

  • @Asimov16
    @Asimov16 8 лет назад

    Thank you for this tutorial. I used this tutorial as a starting point. I got it all working and now I am turning it into a jQuery upload plugin and my plugin now works. I had to replace ondragover with base.on("dragover", function(e) { but basically my jQuery plugin works the same as the javascript code, and I can use it on multiple elements if I require. Now I have to add the bells and whistles and make sure they can't send any old file LOL.

  • @PockyRulez
    @PockyRulez 9 лет назад

    Saved my life during a hackathon! Thanks for the detailed and precise instructions :)

  • @devope
    @devope 7 лет назад

    It's awesome! Thank you so much for overview all details and not using external libraries especially jQuery!

  • @TheFluffyOtter
    @TheFluffyOtter 9 лет назад +24

    didn't work at first. after a long lasting 15 minutes. i actually came up with the fact that i hat my localhost not running.
    pretty imberasssing i say

    • @codecourse
      @codecourse  9 лет назад

      Happens to all of us! At least you sorted it in the end... you'll never make that mistake again!

    • @TheFluffyOtter
      @TheFluffyOtter 9 лет назад

      True

    • @AUTODUDE666
      @AUTODUDE666 9 лет назад +2

      +Codecourse bet he does... :)

    • @fakesapphire8777
      @fakesapphire8777 6 лет назад

      😢$_files works without enctype? But not in my case. I'm trying the same code ..But as soon as I start working with $_files the console log is not responding anymore. I've very limited knowledge on js and php.

  • @MdMasudRana-hi4wl
    @MdMasudRana-hi4wl 6 лет назад

    Your tutorial is amazing, easy to understand, so much helpful and informative.

  • @lexdacurro
    @lexdacurro 8 лет назад +8

    Hi although this is a year ago. you probably won't reply to me. but the XMLHtttpRequest(); does not pass value to the "upload.php" file.
    I literally copy every step you did.

  • @ArtstersRecords
    @ArtstersRecords 8 лет назад

    Alex thank you, you've learned me a lot about javascript.

  • @NotGoodSocially
    @NotGoodSocially 9 лет назад +3

    for some reason it wont run the ondrag events or the on drop event. my code is exactly like yours from what i can tell yet it doesn't run

  • @farazabbas9361
    @farazabbas9361 8 лет назад +5

    when i send fornData using xhr to upload.php, it's not getting the data, and in responseTest, it's showing undefined all the time and nothing showing in php file

    • @sebastian9090123
      @sebastian9090123 6 лет назад

      I am having the same problem. Is there a solution for this?

  • @jakestewart7079
    @jakestewart7079 7 лет назад +1

    What about image compression? Wouldn't that be a must for speed purposes?

  • @schlossguide
    @schlossguide Год назад

    Works fine for me, but not "out of the box". Remember: This tutorial is 8 years old. Going through it, also checking every console.log, brings it to an success.

  • @DreamFreeFPV
    @DreamFreeFPV 8 лет назад

    that's great. I haven't coded in years and am using this to get back into it. i just wished you used Jquery for your JS...

  • @cankarkadev9281
    @cankarkadev9281 3 года назад

    Thank you very much for this great tutorial! Worked like a charm! :D I rewrote my version, my version does not upload the files right after dropping them into the field, it stores them in an array and sends all of the data if the user clicks on the submit button :D

  • @siddheshrane9023
    @siddheshrane9023 8 лет назад +1

    Love your voice! Btw nice tutorial!

  • @bendyamin86
    @bendyamin86 8 лет назад +1

    Would be awesome to have a fallback so you can just click the drag div to allow upload.

    • @weshuiz1325
      @weshuiz1325 5 лет назад

      instead of having a div dropzone try using
      make sure to add a html
      you could actuely try learning or at least google before you ask...

  • @MuhammadUsman-ix6jo
    @MuhammadUsman-ix6jo 9 лет назад +1

    good work bro, How to handle progress bar while uploading files....?

  • @DanteAllighieri
    @DanteAllighieri 4 года назад

    Amazing, really amazing is just what im looking for, thank you very much.

  • @abdulrhmankhallil8254
    @abdulrhmankhallil8254 9 лет назад

    Perfect tutorial
    it helped me a lot
    BIG THANKS

  • @manojsanjeewa1459
    @manojsanjeewa1459 8 лет назад +1

    Hi , we can use this.classList.add("dragover"); rather than this.className.

  • @user-tk1re2hd2y
    @user-tk1re2hd2y 5 лет назад

    Love this tutorial since first seconds

  • @ekaproducciones
    @ekaproducciones 5 лет назад

    Thank you, from Mexico!

  • @Mohk_
    @Mohk_ 6 лет назад

    You saved my life bro thank you

  • @sghsghdk
    @sghsghdk 8 лет назад

    Really great tutorial. Thanks for sharing.

  • @kenyz
    @kenyz 10 лет назад

    21:23 you should use
    anchor.textContent=data[x].name;
    because innerText not working properly in Firefox

  • @Knowideer
    @Knowideer 9 лет назад

    In the "formData.append('files[]', files[x]) line, please could you help me understand the semantics behind 'files[]' , I don't really understand when and where to use the square brackets in such a context.

  • @borisdetry3312
    @borisdetry3312 8 лет назад

    Very good, but is not working with IE and Explorer Edge, but is not just this one. How can I make it work everywhere? Thankyou.

  • @MathLector
    @MathLector 10 лет назад

    Thats exacily a was looking for!

  • @cevadtokatl5327
    @cevadtokatl5327 7 лет назад

    thank you it's simple and works

  • @airdesign.websolutions
    @airdesign.websolutions 10 лет назад

    Could you change an input[type="file"] value with e.dataTransfer.files and submit the form instad of having an ajax request?

  • @classes1012
    @classes1012 7 лет назад

    Hi,
    Odd, working in chrome - but when draging a image over the dropzone I get a not allowed symbol (cirle with strip in it) why??
    looked at other script with samples the same thing so what is wrong
    all help is welcome

  • @billfeck9993
    @billfeck9993 8 лет назад

    I have everything working great. But for my purpose I would like to pass a sting variable that contains which directory I would like the files to upload to. Example: Accounting, Sales, Purchasing, ect.. I found how to pass it to my PHP file using this statement: formData.append('department', 'Accounting'); I would like to use it more dynamically and pass the string 'Accounting' as a variable named 'department'. That way I can just make a call to the external javascript in my HTML files and pass the 'department' variable to it. Any ideas on how i can do that?

  • @kentthomas1045
    @kentthomas1045 6 лет назад

    I'd like to upload and have the latitude and longitude be read from the file upload - or the location data - then the user to add a name - + an autogenerated #id - How do I carry this out?

  • @opionetics
    @opionetics 8 лет назад +1

    great material as always! what about if we had to pass in csrf token as in laravel ...before posting??

    • @AllobanG
      @AllobanG 7 лет назад

      I have this problem. do you have solution to this now?

  • @micharogozinski2371
    @micharogozinski2371 9 лет назад

    Thank you for video.
    Actually, can you upload this code somewhere?
    Any idea how to make file managment via website? Like list of files in uploads folder and options like remove, rename file?

  • @alrickrock1828
    @alrickrock1828 7 лет назад

    How do i get the code tested during programming, I have follow your steps in creating the code

  • @mauropn
    @mauropn 8 лет назад

    Fantastic !!
    Thanks !!!!

  • @letrat7021
    @letrat7021 9 лет назад

    what if i wanted to store my files in a database? how would i go about that?

  • @iamfuckingyourwaifuandther2743
    @iamfuckingyourwaifuandther2743 7 лет назад

    Dang we can't use this for commercial use :(? Know anywhere I can learn code that I can learn for commercial use? Almost everywhere I go I try to learn code but they all say I can't use for commercial. I don't know how I'm supposed to make a job out of learning code if I learn from somewhere I can't even use code from :/

  • @angkolmer00
    @angkolmer00 8 лет назад +1

    how can i create a random name where should i do this.? hash('algorithm',$name.time());

  • @hyiping5926
    @hyiping5926 5 лет назад

    Why cant i get the length of the files with files.length ? it is undefined, and i chekked i have something in files, but it seems like its an object? it is only when i choose 1 file ?

  • @Mustafaismail22
    @Mustafaismail22 10 лет назад

    very good tutorial
    Thanks

  • @webslesson
    @webslesson 8 лет назад

    Awesome video

  • @fakesapphire8777
    @fakesapphire8777 6 лет назад

    My editor sublime text is not recognising $_FILES can anyone suggest anything?

  • @victorstine
    @victorstine 8 лет назад

    Hello. I am having trouble with sending the form data using xhr i.e xhr(formData) ... it keeps returning undefined in the response text. I cannot continue until this works..what is wrong?

    • @victorstine
      @victorstine 8 лет назад

      +Angel Beats Sorry solved it. Spelling error for responseText

  • @cesaregonzi1951
    @cesaregonzi1951 9 лет назад +1

    Nice video, could you please share index.html and upload.php files?

  • @YersonCrespo
    @YersonCrespo 8 лет назад

    Excelent!

  • @codecourse
    @codecourse  10 лет назад +10

    HTML5 Drag and Drop Uploading

    • @thefizsz6274
      @thefizsz6274 6 лет назад +1

      You do realize none of this code is working right? I debugged nearly everything and it seems none of this is up to date.

    • @ChristianRuppelt
      @ChristianRuppelt 6 лет назад

      He states that this won't work in all browsers and it’s 4 years old …

  • @Tutoriaisnanet
    @Tutoriaisnanet 9 лет назад

    Please, how suposed to be the security way to do this?

  • @adilismail3593
    @adilismail3593 5 лет назад

    Not working on firefix why

  • @danielgavalec4167
    @danielgavalec4167 8 лет назад

    Is it possible to download full script somewhere? i really dont know where is problem.

  • @AlexandrGeffest
    @AlexandrGeffest 8 лет назад

    Why don't use Emmet? It would make codewriting more faster

  • @vbfcalija
    @vbfcalija 8 лет назад

    I got an error of:
    Unexpected token < in JSON at position 0
    When I upload an image with a size of 8Mb +.
    Can someone help me with this please?

    • @majorbadidea
      @majorbadidea 7 лет назад

      jsonlint.com/#
      validate the json

  • @sushantgautam773
    @sushantgautam773 6 лет назад

    how to animate the file upload sucess

  • @deepmondal8564
    @deepmondal8564 7 лет назад

    browser support for this tutorial??? not working on firefox and internet explorer

  • @thefizsz6274
    @thefizsz6274 6 лет назад

    I am receving Uncaught TypeError: Cannot set property 'ondrop' of null in the ondrop method. Any ideas, solutions?

    • @koreaaria
      @koreaaria 6 лет назад

      you have to write your js block after input whose id is 'dropzone' before body's end tag

    • @Mrflippy4
      @Mrflippy4 6 лет назад

      His example calls the JS function before the DOM has loaded all the elements. The DOM hasn't yet loaded the id which is why it's null. Do something like window.addEventListener("load", initiate); then create a function called initiate and place the above code in. This will ensure the window has loaded all the necessary components before the function is triggered. Hopefully this helps.

  • @CJBurkey
    @CJBurkey 9 лет назад

    how do you get your cursor to blur like that?

  • @et3802
    @et3802 10 лет назад

    Just a curiosity, have anyone tried this with firefox?
    Somehow I got it working perfectly in chrome but when I try it with firefox, the files uploads perfectly but the link to the files doesn't show.
    Anyone got this problem?

    • @et3802
      @et3802 10 лет назад +1

      ah! nevermind as 'Cor van Dooren' said innerHTML instead of innerText works. Just that innerText is not supported by firefox

    • @micharogozinski2371
      @micharogozinski2371 9 лет назад

      ET I've got same problem. Thanks for usefull tip!

  • @abdullahhaider
    @abdullahhaider 9 лет назад

    does this drag and drop uploading use ftp protocol?

  • @Asimov16
    @Asimov16 8 лет назад

    If I am already using jQuery would it be better to use jQuery rather than javascript, or is javascript better for this?

    • @subratmainali8860
      @subratmainali8860 8 лет назад

      AFAIK JQuery is JS. It's just a different, and usually preferred, way of writing JS.

  • @jhoxystorres2614
    @jhoxystorres2614 8 лет назад

    Graciassssss buen tuto

  • @yonimelech
    @yonimelech 10 лет назад

    Very helpful, thank you for the guide!

  • @kolby9655
    @kolby9655 8 лет назад

    my consol gives me an error if i try to upload an image
    the Error:
    main.html:24 XMLHttpRequest cannot load file:///C:/Users/user1/Desktop/HTML/D&D/main_PHP.php. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.upload @ main.html:24Dropzone.ondrop @ main.html:29

    • @majorbadidea
      @majorbadidea 7 лет назад

      you have to set up an e.g. apache server
      (xampp for windows will be enough for you)

  • @_Mackan
    @_Mackan 10 лет назад +1

    Can you have the javascript in an external file?

    • @codecourse
      @codecourse  10 лет назад +1

      Indeed you can. Recommended.

    • @micharogozinski2371
      @micharogozinski2371 9 лет назад

      Have you done external file? I've done it, but it doesn't work as an external file

  • @farazabbas9361
    @farazabbas9361 8 лет назад

    hi Alex, i'm having an issue with this script, can you please help me

  • @sjl4554
    @sjl4554 6 лет назад

    To whom found php wouldn't work, use a php server like using "php -S localhost:8000" runing a local server on linux.

  • @kamrulhassan3115
    @kamrulhassan3115 7 лет назад

    Can you provide the code ?

  • @goodmanEnt
    @goodmanEnt 10 лет назад

    What type of text editor are you using?

  • @VS-ic3by
    @VS-ic3by 6 лет назад

    Where can i get the source code?

  • @ElliotLaFave
    @ElliotLaFave 8 лет назад

    im having trouble with e.preventDefualt JS can anybody help me with that?

  • @DerNivel
    @DerNivel 10 лет назад +5

    why you're typing "x = x + 1" and not "x++"?

    • @codecourse
      @codecourse  10 лет назад

      It's habit after hearing Douglas Crockford speak on the subject. See stackoverflow.com/questions/971312/why-avoid-increment-and-decrement-operators-in-javascript for more information on this, there are some good links in there.

    • @kishannr911
      @kishannr911 7 лет назад

      eslint.org/docs/rules/no-plusplus

  • @saburius
    @saburius 8 лет назад

    Does not work at all...

  • @EbbesMedia
    @EbbesMedia 10 лет назад

    Hello there,
    Are there an other solution than "move_uploaded_file"? My webservice doesn't support that function which is a big handicap for me. My webservice use php 5.3.xx

    • @edekroon988
      @edekroon988 10 лет назад

      you should think about switching to atleast a 5.4 server.

    • @EbbesMedia
      @EbbesMedia 10 лет назад

      They won't update the php version, so that's why I asked for another solution :)

    • @edekroon988
      @edekroon988 10 лет назад

      I ment switching hosting provider.

    • @codecourse
      @codecourse  10 лет назад

      DeeJayEbbes Highly recommend you switch to something that allows you more flexibility. Why not set up your own VPS on Digital Ocean? It's easy, and we have a series on getting it all set up. Cloud Server Set Up: Introduction (Part 1/8)

    • @mikkompeltonen
      @mikkompeltonen 10 лет назад

      According to the PHP manual, it has been supported since 4.0.3. www.php.net/manual/en/function.move-uploaded-file.php

  • @Tutoriaisnanet
    @Tutoriaisnanet 9 лет назад

    How do this thing limiting one file per upload?

  • @marcelo.junior2478
    @marcelo.junior2478 5 лет назад

    DON'T WORK ANYMORE !!

  • @rohanrana187
    @rohanrana187 8 лет назад

    this one is nice but also i want to store this file or its path in database how can i

  • @saburius
    @saburius 8 лет назад

    Stop removing comments just because they are not what you like. This script doesn't work at all.

    • @lukedavies2874
      @lukedavies2874 8 лет назад +2

      Suburius, If this project did not work for you then please consider numerous variables as to why it hasn't worked. Such as out of date code seeing this code is 3 years old now. Maybe a syntax error in your code somewhere.? Or if you want to become a developer yourself how about finding a way to debug the issue. Just a suggestion.

  • @tik68
    @tik68 10 лет назад

    1ST

  • @Maro18Z
    @Maro18Z 7 лет назад +1

    Did this nigga just write x=x+1?

  • @ginbarato1178
    @ginbarato1178 3 года назад

    This does not work, dont waste your time. The channel is good but dont waste a few minutes trying this, as it wont work