54: How to delete files from folder - PHP tutorial

  Рет қаралды 59,319

Dani Krossing

Dani Krossing

Күн бұрын

How to delete files from folder - Learn PHP backend programming. In this episode we will learn how to easily delete/remove files and images from you websites rootfolder.
Deleting files is easy to learn and can be accomplished using a simple PHP function.
➤ GET ACCESS TO MY LESSON MATERIAL HERE!
First of all, thank you for all the support you have given me!
I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!
I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.
I hope you will find it helpful :)
Material for this lesson: / lesson-material-42361704

Пікірлер: 38
@crack9058
@crack9058 7 жыл бұрын
Your PHP whole sessions are incredible till now .
@Dani_Krossing
@Dani_Krossing 7 жыл бұрын
Thank you :) I'm glad you think so.
@mariamzayed91
@mariamzayed91 4 жыл бұрын
thank youuu🥺 i actually watched the whole ads to thank u
@Soulof8d
@Soulof8d 3 жыл бұрын
🔥😁
@SpaceSlug_
@SpaceSlug_ 3 жыл бұрын
Am currently studying and all your videos have been such a help. Thanks my dude!
@gustavomarquesdasilva1167
@gustavomarquesdasilva1167 7 жыл бұрын
this actually worked. Good tutorial. Very straightforward. Thanks.
@mwangazatv1800
@mwangazatv1800 7 жыл бұрын
You are a real programmer
@fundamentalmarketersclient6945
@fundamentalmarketersclient6945 2 жыл бұрын
Thank you so much. Wonderful Video
@KimaniWaNdirangu
@KimaniWaNdirangu 6 жыл бұрын
Thanks Daniel.Very useful functionality.
@isaacquarshie2563
@isaacquarshie2563 5 жыл бұрын
It worked for me Thanks...I appreciate.. :)
@ehokify583
@ehokify583 2 жыл бұрын
Great Work!
@chaddsmith3354
@chaddsmith3354 3 жыл бұрын
Thank you for the video!
@Izkawi33
@Izkawi33 Жыл бұрын
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
@ngjhunnen
@ngjhunnen 7 жыл бұрын
nice sir... thank you so much
@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?
@deepeddyrecords5933
@deepeddyrecords5933 3 жыл бұрын
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.
@thegreenmonster650
@thegreenmonster650 5 жыл бұрын
Yolo......! it worked. Thanks.....
@BalkanLeaksArchive
@BalkanLeaksArchive 2 жыл бұрын
Can you plaease record how to delete all posts older than 1 day from mysql with php every day without CRON.
@zahirzohair1372
@zahirzohair1372 7 жыл бұрын
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 7 жыл бұрын
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 7 жыл бұрын
thank you very much for your nice reply and valuable time! of course it helped me a lot.
@aidaspatapavicius7654
@aidaspatapavicius7654 6 жыл бұрын
help doesnt work :/
@edlb10
@edlb10 6 жыл бұрын
thanks it worked
@HanoMontano1
@HanoMontano1 3 жыл бұрын
thx a lot man
@АртемВолков-ю5ь
@АртемВолков-ю5ь 7 жыл бұрын
Nice)) how to delete multiple files?
@Dani_Krossing
@Dani_Krossing 7 жыл бұрын
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 7 жыл бұрын
Hi again, I am uploading an episode tomorrow morning on how to delete multiple files :)
@АртемВолков-ю5ь
@АртемВолков-ю5ь 7 жыл бұрын
Thank you))
@misterzerocrypto4749
@misterzerocrypto4749 3 жыл бұрын
where is the update file
@madcorndog
@madcorndog 4 жыл бұрын
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.
@madcorndog
@madcorndog 4 жыл бұрын
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 4 жыл бұрын
for that use SQL to select a file and then delete a file
@movine2344
@movine2344 6 жыл бұрын
You should work in Facebook
@armastro99
@armastro99 7 жыл бұрын
Great video!
@Dani_Krossing
@Dani_Krossing 7 жыл бұрын
Thank you :)
55: Delete more than one file or image in PHP - PHP tutorial
15:16
Dani Krossing
Рет қаралды 36 М.
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 19 МЛН
My daughter is creative when it comes to eating food #funny #comedy #cute #baby#smart girl
00:17
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 58 МЛН
How to upload image to MySQL database and display it using php
21:06
Coding with Elias
Рет қаралды 289 М.
PHP: Video Upload & Playback (Using Database)
27:27
Coding with Elias
Рет қаралды 51 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
PHP File Uploads | The Complete Guide to Uploading Files Using PHP
19:28
Dave Hollingworth
Рет қаралды 43 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 19 МЛН