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?
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 ?
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!
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
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 :)
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.
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]
Your PHP whole sessions are incredible till now .
Thank you :) I'm glad you think so.
Am currently studying and all your videos have been such a help. Thanks my dude!
this actually worked. Good tutorial. Very straightforward. Thanks.
You are a real programmer
Thank you so much. Wonderful Video
thank youuu🥺 i actually watched the whole ads to thank u
🔥😁
Thanks Daniel.Very useful functionality.
It worked for me Thanks...I appreciate.. :)
Thank you for the video!
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?
nice sir... thank you so much
Great video!
Thank you :)
Yolo......! it worked. Thanks.....
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 ?
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!
thank you very much for your nice reply and valuable time! of course it helped me a lot.
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
thanks it worked
thx a lot man
Can you plaease record how to delete all posts older than 1 day from mysql with php every day without CRON.
Nice))
how to delete multiple files?
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 :)
Hi again, I am uploading an episode tomorrow morning on how to delete multiple files :)
Thank you))
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.
help doesnt work :/
where is the update file
I like watching this channel because every other channel is some guy from India with a REALLY bad mic.
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]
for that use SQL to select a file and then delete a file
It dont work for me. It's says there is no such file or directory BUT THERE ISSSS! AND I CHECKKED!
Same issue for me.
You should work in Facebook
Great Work!