PHP Front To Back [Part 19] - File System Functions

preview_player
Показать описание
In this video we will look at some functions to work with files, folders and paths such as basename(), dirname(), file_get_contents(), fopen(), fread() and much more

CODE: Code for this video

BROWSER EXTENSION: Momentum

EDUONIX COURSES: Please use affiliate links from website below

SUPPORT: We spend massive amounts of time creating these free videos, please donate to show your support:

FOLLOW TRAVERSY MEDIA:
Рекомендации по теме
Комментарии
Автор

you are like family ;) after so many good videos and the honest way you sound

pepeback
Автор

I am a college student and i am doing my last semester project, i am glad i saw your videos about php you helped me a lot with these videos . You are a better teacher from any other teacher at my college!!

teraspa
Автор

I used to hate php but i am loving it now, thanks man keep it up, we really appreciate your efforts, so useful

aymanmakhoukhi
Автор

If anyone else was confused like I was, "fread" on line 62 takes two parameters, the $handle we defined and a file size it reads up to. To read the whole file we used the filesize function to read every byte of the file.

DrazV
Автор

Nice series broken down to small pieces so that it is easy to follow and easy to go back to topics that need to be refreshed. Also Brad takes the time to show the alternative scenarios when entering lines of data.

bobscherr
Автор

Some of instructor's courses are very long but we can not feel we learned comperhensive information. But after watching your videos, I am feeling very good and completed about course content. Thank you so much for that I am feeling confident about subjects that you taught

bugraates
Автор

If you type mkdir() then get a "permission denied" error just go to file folder then right click and click "Get Info" in "Sharing & Permissions" change all from "Read only" to "Read & Write" . And for windows users just right click on the folder => properties then remove checkbox form "Read Only"

Ali-aljabri
Автор

Fantastic videos Brad. I've been working through your PHP playlist for the past couple of days and you are a fantastic teacher.

realwizardry
Автор

I really liked this series please keep sharing video Brad. Your all videos awesome you are really good teacher..

cagrioz
Автор

"Lets pass in $file and we get nothing thats because there is no $file2 .... " lmao so calm and steady was funny.

TheFippe
Автор

Yes! Been looking for this type of file implementation with php. Thanks!

Will you do any tutorials on chatbots? Thinking it'll be a good add ons to ur php MySQL ecommerce tutorials

enrico
Автор

Notes:

1:27 - basename() function returns the filename from a path.

2:00 - basename(path, '.php'); returns the filename without the extension.

2:40 - dirname() function returns the directory name from the path.

4:03 - file_exists() function returns a 1 if the file exists. (files and folders)

4:57 - realpath() function returns the entire path of a file.

6:00 - is_file() function returns a 1 if the file exists. (only files)

6:38 - is_writable() function returns a 1 if the file is writable.

7:14 - is_readable() function returns a 1 if the file is readable.

7:40 - filesize() function returns the size of the file. (in bytes?)

8:14 - mkdir() function creates a directory. (creates folder)

8:46 - rmdir() function deletes a directory as long as there are no files inside.

9:53 - copy(param1, param2) function copies a file into a new file. (param1 - old copy, param2 - new copy)

10:25 - rename(param1, param2) function renames a file. (param1 - old name, param2 - new name)


11:00 - unlink() function deletes a file.

11:43 - file_get_contents() function writes from file to string.

12:18 - file_put_contents(filename, data) function that writes to file

gracialonignasiver
Автор

Please Brad add more videos in this playlist

adilmughal
Автор

Thanks a million for the great course, Brad. At 14:00 appending to a file seemed a bit too complicated to me and i was wandering if there is a way to do it in less code and res usage. I've found that file_put_contents() takes its mode as a parameter, so " file_put_contents($file, 'goodbye world', FILE_APPEND); " would work as well.

michaelgtz
Автор

Brad your courses high quality thanks for that and please upload new videos :)

cagrioz
Автор

Thank you sir i learn a home of knowledge from your channel i once again appreciated

ahmadhabibi
Автор

thanks for the php tutorials...it has been a blast so far. keep do it...your are great teacher.

racingrival
Автор

is it possible to create a .js file and edit/read/write it using these methods? And maybe use that .js file as a psuedo database ? maybe by inserting 'arreys in form of text'? ( just an experiment )

_kamble_aditya_laxman
Автор

Hi Brad, as always great content (audio and visuals) with superb pacing. Can't wait to you do the follow-up video on PHP with a database.
just out of interest all of your files reference were to 'xxx.php' how can I use PHP but still have a .html type file (sorry if this is a dumb question but I'm a total newbie on Web software)

cheers
Michael

michaeldalby
Автор

Thank you for the video. I would like to use either 'dirname()' or 'opendir()' in PHP within the context of a WordPress site to access a directory that exists outside the context of a WordPress site's directory structure. For example, I have a collection of media files that are stored on a network attached storage (NAS) device and want to build a WordPress site that can access these files, as well as files that exist in other locally attached physical media (local hard drive, thumb drive, DVD drive, etc.) The rationale for this approach is to avoid duplicating these media assets by pulling them into my WordPress site's Media Library. Unfortunately, when I try to access these files with 'dirname()' or 'opendir()', WordPress returns a 'no such directory' found error message. I've tried to tracing the genesis of this error, and I do not think it necessarily relates to PHP. Instead, I suspect WordPress uses a security model out of the box that prevents one from accessing files that are not contained within a WordPress web site's directory strucuture. Your feedback is appreciated.

aspsa