Like in a WordPress website, photos added in posts inside dashboard post editor are kept in dynamically generated year months directories inside wp-content/uploads directory by default. This blog will assist you to make directory in PHP and we will then create year months folders at our server.
Category » PHP
Ajax Image Upload using PHP and jQuery
Ajax Image Upload using PHP and jQuery is very important topic nowadays because everybody wants to save their data without refreshing the page. Today we are going to generate an Ajax based image uploader, which means the image file will be uploaded to server using Ajax request, without reloading the page.
Drag n Drop Multiple AJAX Images Upload with Progress Bar
AJAX is an important part in web development. This blog post covers steps to handle AJAX image upload with progress bar in Bootstrap with drag n drop feature. Some cool features in these steps are.
Google New reCaptcha using PHP – Are you a Robot?
Recently Google introduced a simplified “captcha” verification system (video) that enables users to pass the “captcha” just by clicking on it. This API utilizes an Advanced Risk Analysis engine that is capable of discerning between users and bots
Automatic Update Copyright Year
Still wonder how to automatic update copyright year instead of changing hard-coded value each year. Lol!! You need some fresh air to let your mind breathe. Use PHP’s date() function which can echo the current year in your copyright text.
Copyright ©< ?php echo date('Y'); ?> | Your Company Name
3 functions to check if string contains specific words
check for existence of a substring into a string is a common requirement for programmers. Here I’m describing 3 functions to check if string contains specific words.
- strpos – Find the position of the first occurrence of a substring in a string.
- strstr – Find the first occurrence of a string
- preg_match – Perform a regular expression match
15 PHP Interview Questions for 1 Year Experienced (II)
Here is a good collection of 15 PHP Interview Questions and Answers which are mostly asked from 1 year experienced PHP programmer and are useful for others too. Don’t forget to check first part of PHP Interview Questions series as well.
Number of days in a month
PHP provides functions to get the number of days in a month for a specified year and calendar. We can use date(‘t’) or cal_days_in_month. See syntax, parameters and examples in rest of the article.
Embed base64 encoded images
Most modern desktop browsers such as Chrome, Mozilla, Internet Explorer supports images encoded as data url. But there are problems displaying data URLs in some mobile browsers like Android Stock Browser.
Here we are presenting that how we can embed base64 encoded images in various platforms.
Apply foreign key in phpMyAdmin using database query
If you already have database tables and you just want to apply foreign keys for record on those table then you can apply foreign key in phpMyAdmin using database query also.
I have already written a tutorial ‘Setting up foreign key in phpMyAdmin‘ with example images and I prefer to write database query to set up foreign key in existing database tables as queries allow me to accomplish all required steps in once go.