55: Delete more than one file or image in PHP - PHP tutorial

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 40

  • @akashgola2153
    @akashgola2153 7 місяців тому

    Nice logic kinda figured what u gonna do halfway ,now with each video i am learning something new like hey that's where u use 'string.replace or unlik, or glob' etc. Cool

  • @tor0most3r47
    @tor0most3r47 6 років тому +10

    the script become easier if you use a foreach loop instead the for loop, and using the all the first loop you can control and delete the files

  • @Julio860JVL
    @Julio860JVL 4 роки тому +3

    On previous tutorials you used die() instead of exit(). I did a quick Google search and both functions do the same. Is there an specific reason why you used exit() in this tutorial but used die() on all of the other tutorials?
    Thanks for the videos btw!
    Cheers!

  • @jeremy_s
    @jeremy_s 7 років тому +2

    Thanks for your tutorials, found and LOVE your channel. Especially this PHP series, It would be great to see a cURL tutorial, and connecting with API's tutorial in the future :) Cheers!

  • @abdoalaasadik
    @abdoalaasadik 4 роки тому

    really liked your tutorial

  • @ComputerHelpHawaii
    @ComputerHelpHawaii 4 роки тому +1

    Question about the first for loop on line 7. You said you're just looking to see if it exists so wouldn't in_array be faster?

    • @turbosardar39
      @turbosardar39 4 роки тому +2

      But how would you know what file is missing using in_array?
      I think with for loop you can even print this missing file.... I'm not you can do that with in_array.
      If you can please explain cause I'm new to php and that would be helpful.
      Thanks!

    • @ComputerHelpHawaii
      @ComputerHelpHawaii 4 роки тому +1

      @@turbosardar39 It's been a while since I've watched this but whatever file you're looking to see if it exists is the one that exists. In other words you're comparing the array to something,. That something is the file.

    • @turbosardar39
      @turbosardar39 4 роки тому +2

      @@ComputerHelpHawaii the video is about deleting multiple files...so we need if all files exists...if it was only one file in that case in_array would be efficient...but in case of multiple files i think for loop is more efficient as you can even print the name of the missing file.

    • @ComputerHelpHawaii
      @ComputerHelpHawaii 4 роки тому +1

      @@turbosardar39 I don't know. Do you want a foreach loop going through each file looking for a match or do you just want to know if it exists, but jmo for what it's worth. I'm so busy I may have misinterpreted and you could be absolutely correct. Good luck with your education process which by the way never ends :-)

  • @maulahaz
    @maulahaz 5 років тому

    Thanks.. your tuts solving my problem.

  • @ДаниилКиселев-к3к
    @ДаниилКиселев-к3к 7 років тому +2

    Very helpful. Thanks

  • @ribaljeanhaddad3630
    @ribaljeanhaddad3630 4 роки тому

    can you make a video how to delete multiple data and image from database and folder using checkbox thx

  • @calvinchong5179
    @calvinchong5179 7 років тому

    Thanks for your tutorials, now I think I can code a php file that can delete my friend's dota2 root folder.

    • @StraBau
      @StraBau 4 роки тому

      and tell me how , this code is only for separatet files not a folders...

  • @ngjhunnen
    @ngjhunnen 7 років тому

    you are so great ... thank you sir

  • @davidshefcik
    @davidshefcik 7 років тому

    Hey. I was just wondering what is the name of your keyboard? :p

  • @akhilkazi1454
    @akhilkazi1454 4 роки тому

    Hello sir i want to use this code in table row for deleting rows. Help me.

  • @Shiheha
    @Shiheha 6 років тому +1

    in 11:34 , if the "if statment" is true , we go to header and to another page ( index.php) and leave this page (and this loop ) , why we need the "exit() " function ?

    • @ComputerHelpHawaii
      @ComputerHelpHawaii 4 роки тому

      I have an exit function after calling another script just in case in one of my more recent scripts.

  • @appiahemmanuel490
    @appiahemmanuel490 4 роки тому

    Thanks for your good work done, but i would like you to assist me in building a tracking system. i will be looking forward to hear from you thanks.

  • @StraBau
    @StraBau 4 роки тому

    whitch line mus be edited for delete folders. I need deleted folder not only files ..

  • @kartikraj6629
    @kartikraj6629 6 років тому +1

    What is your code editor name...???

  • @princemawan8152
    @princemawan8152 6 років тому

    Hi i have "permission denied error on unlink function" what should i do?

  • @yungifez
    @yungifez 4 роки тому

    8:15 can you not like use a for each loop instead of using that method

  • @Thadnill
    @Thadnill 4 роки тому

    how do I delete a certain line/object from a txt file? I am creating my guest book with OOP PhP, and I am trying to solve my delete button, where I delete a chosen post, each post is it's own html table row, and I also want to delete the object within the txt file (my database), but I am completely stuck and could use some tips..

    • @turbosardar39
      @turbosardar39 4 роки тому

      Have you solved it?

    • @Thadnill
      @Thadnill 4 роки тому

      @@turbosardar39 yeah I did :) you having the same problem?

  • @nextinline619
    @nextinline619 6 років тому

    Hey, can't I just use the file selector and select the file and post it out to the deletefile.php and get the name of the file through $file['name'] and make the path this :
    $path = "uploads/".$filename;
    then I can unlink the file like I did in the previous video.
    why would I need to do so much work and type out each file name in order to delete files? shouldn't I just select them through the file selector?

    • @unzudgeo
      @unzudgeo 6 років тому

      I was thinking the same thing. Did you implement this idea?
      I am going to have a go at it...

    • @unzudgeo
      @unzudgeo 5 років тому

      @yusef 258 thanks bro

  • @АртемВолков-ю5ь
    @АртемВолков-ю5ь 7 років тому

    Cool

  • @thasan4509
    @thasan4509 7 років тому

    What if I enter index.php to filename?

    • @Dani_Krossing
      @Dani_Krossing  7 років тому

      Thasan That won't work since we are searching inside the uploads folder. However to make it completely safe I would recommend also doing a check to make sure only certain files with specific extensions can be deleted.

    • @thasan4509
      @thasan4509 7 років тому

      mmtuts oh.. thats true, didint noticed it was on upload folder.. So, ../index.php

    • @Dani_Krossing
      @Dani_Krossing  7 років тому +2

      Thasan Yeah I thought about the ../ before going to bed. I would create an error handler identical to the str_replace we did in this episode that removes any ../ from the string :)

    • @Dani_Krossing
      @Dani_Krossing  7 років тому +2

      I just added an annotation to the video that shows how to avoid users going back a folder :) Thanks for pointing it out.

  • @eki8096
    @eki8096 7 років тому

    i got permission denied :/