54: How to delete files from folder - PHP tutorial

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

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

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

    Your PHP whole sessions are incredible till now .

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

    Am currently studying and all your videos have been such a help. Thanks my dude!

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

    this actually worked. Good tutorial. Very straightforward. Thanks.

  • @mwangazatv1800
    @mwangazatv1800 7 лет назад +2

    You are a real programmer

  • @fundamentalmarketersclient6945
    @fundamentalmarketersclient6945 2 года назад

    Thank you so much. Wonderful Video

  • @mariamzayed91
    @mariamzayed91 4 года назад +2

    thank youuu🥺 i actually watched the whole ads to thank u

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

    Thanks Daniel.Very useful functionality.

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

    It worked for me Thanks...I appreciate.. :)

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

    Thank you for the video!

  • @jithuwilsoncit9631
    @jithuwilsoncit9631 2 года назад

    Thanks it worked but I have doubt, how to implement it in CI4? How to set path for unlink('./'.$filename) when the current siiiting page address is ControllerName/something/something in URL?

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

    nice sir... thank you so much

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

    Great video!

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

    Yolo......! it worked. Thanks.....

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

    you are teaching really well. it is so helpful for me. but i have problem with admin authentication and user authentication in a portal. for example, a teacher as an admin can upload the assignment with instructions and specify the due date to be submitted. the student as a user only can upload the answer and maybe post a comment but cannot do any changes to the dude date of the assignments and cannot edit the instructions. how to set their authenticity ?

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

      You can create separate tables to assign "user roles" to your users. This can either be done in a complicated or simple way, depending on your need. If your application is still as simple as what we have done in these lessons here, then the SQL table code bellow should be good enough.
      //This table creates the user role table
      CREATE TABLE Roles {
      id int(11) not null PRIMARY KEY AUTO_INCREMENT,
      role varchar(256) not null
      }
      //These inserts creates the roles you want to have on your website, you can just add or remove roles if you don't want them
      INSERT INTO Roles (role) VALUES ("Standard User");
      INSERT INTO Roles (role) VALUES ("Super User");
      INSERT INTO Roles (role) VALUES ("Guest");
      //This table allow the roles from the previous table to get linked to users
      CREATE TABLE User_Role {
      id int(11) not null PRIMARY KEY AUTO_INCREMENT,
      user_id int(11) not null,
      assign_role varchar(256) not null
      }
      //These inserts assigns the roles from the previous table to users. The bellow line would as an example link the user with an "id" as "1", to your "Standard User" role.
      INSERT INTO User_Role (user_id, assign_role) VALUES ("1", "2");
      With the user roles created, you just need to make sure that EVERYTIME you create a new user, they get assigned a role in the same script you use when they sign up. And then using PHP you just only allow teachers/admins (who has the "Super User" role) to specify due dates. And regarding the students you just need to make sure that "Standard Users", should only be allowed to have access to the "upload" link, before the date the teacher/admin specified. You can use one of the build in PHP date functions for this.
      Hope this helped!

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

      thank you very much for your nice reply and valuable time! of course it helped me a lot.

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

    thank you can you help me how to update the old file means update the field in the table with the new name and unlink the old file name and upload the new file

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

    thanks it worked

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

    thx a lot man

  • @BalkanLeaksArchive
    @BalkanLeaksArchive 2 года назад

    Can you plaease record how to delete all posts older than 1 day from mysql with php every day without CRON.

  • @АртемВолков-ю5ь
    @АртемВолков-ю5ь 8 лет назад +2

    Nice))
    how to delete multiple files?

    • @Dani_Krossing
      @Dani_Krossing  8 лет назад +3

      It depends on the reason for deleting multiple files... but an example (WITHOUT using JavaScript) could be that you write the name of all the files you want to delete by adding an input to your form and separate the names by a comma (,). Then in the script when you submit the form, you just use the explode() function to separate the names and insert them into an array. Then you just loop the array using a foreach loop, and use the unlink() function inside each loop :)

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

      Hi again, I am uploading an episode tomorrow morning on how to delete multiple files :)

    • @АртемВолков-ю5ь
      @АртемВолков-ю5ь 8 лет назад +1

      Thank you))

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

    It works great for me except that after submitting, my browser goes to the deletefile.php. I fixed that by adding these lines to deletefile.php: header("Location: ../index.html"); die(); Put these two on two separate lines. Otherwise, excellent tutorial. Just what I was looking for.

  • @aidaspatapavicius7654
    @aidaspatapavicius7654 7 лет назад +4

    help doesnt work :/

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

    where is the update file

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

    I like watching this channel because every other channel is some guy from India with a REALLY bad mic.

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

    I need something real useful. Ex: few images (saved in a folder) displayed on the browser. Click on one of them. And that specific image is delete. With Array[i]

    • @guruprasath997
      @guruprasath997 5 лет назад +1

      for that use SQL to select a file and then delete a file

  • @madcorndog
    @madcorndog 5 лет назад +2

    It dont work for me. It's says there is no such file or directory BUT THERE ISSSS! AND I CHECKKED!

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

      Same issue for me.

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

    You should work in Facebook

  • @ehokify583
    @ehokify583 2 года назад

    Great Work!