Store and Retrieve Image from Database using PHP MySQL

On 6/19/2017 Be the first to comment!

Hi! In this tutorial let's see how to store and retrieve image from mysql database using php. Have you ever tried to store images in a database? If not then we'll fix it now. Once upon a time it's been a developer's dream to save images in database just like any other numbers and texts. But thanks to the evolvement of relational databases, saving and fetching images to and from database is made possible these days. And the process is also less complicated than storing uploaded images to some folder on server.

Storing Image in MySQL Database

So, the question is how can you store images in mysql database? Well, using BLOB data type. BLOB stands for binary large data object and used to store large amount of binary data. Using this you can not only store pictures but also audio and other multimedia files in database.

Basically there are four types of BLOB available in mysql. They are:

  • TINYBLOB
  • BLOB
  • MEDIUMBLOB
  • LONGBLOB

All of these data types are similar except for the size of data they can hold.

Come let me show you how to store and display image from database using this BLOB type.

Read Also:

First let's create a database and a simple table for storing images.

MySQL Database Creation

CREATE DATABASE IF NOT EXISTS `db_demo`;
USE `db_demo`;
CREATE TABLE IF NOT EXISTS `tbl_gallery` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `imagedata` blob NOT NULL,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

How to Insert Image into MySQL Database using PHP?

So the process goes like this. User uploads image via an uploading form which is then submitted to server. Then the image is converted into binary and inserted into mysql database along with its details such as name and time of creation.

index.php

This file contains the upload form for user to upload images to database.

<!DOCTYPE html>
<html>
<head>
    <title>Insert Image into MySQL Database using PHP</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" >
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
</head>
<body>
<br/>
<div class="container">
    <div class="col-xs-8 col-xs-offset-2 well" style="background:none;">
    <form action="upload.php" method="post" enctype="multipart/form-data">
        <legend>Please Choose Image to Upload</legend>
        <div class="form-group">
            <input type="file" name="glryimage" accept="image/*" />
        </div>
        <div class="form-group">
            <input type="submit" name="submit" value="Upload Image" class="btn btn-danger"/>
        </div>
        <?php if(isset($_GET['st'])) { ?>
            <div class="alert alert-danger text-center">
            <?php if ($_GET['st'] == 'success') {
                    echo "Image uploaded successfully!!!";
                }
                else
                {
                    echo 'Error uploading image...';
                } ?>
            </div>
        <?php } ?>
    </form>
    </div>
</div>
</body>
</html>

dbconnect.php

This php file contains the script for database connectivity. Here we establish the connection to mysql database via php code. Please make sure to change the connection settings as per yours.

<?php
//connect mysql database
$hostname = "localhost";
$username = "root";
$password = "";
$database = "db_demo";
$con = mysqli_connect($hostname, $username, $password, $database) or die("Error " . mysqli_error($con));
?>

upload.php

This is the actual uploading script. Here we receive the uploaded file, check if it is a valid image, convert image into binary data and insert image data and details into the database with php code.

<?php
include_once 'dbconnect.php';

//check if form submitted
if (isset($_POST['submit']))
{
    $img_name = $_FILES['glryimage']['name'];

    //upload file
    if ($img_name!='')
    {
        $ext = pathinfo($img_name, PATHINFO_EXTENSION);
        $allowed = ['png', 'gif', 'jpg', 'jpeg'];
    
        //check if it is valid image type
        if (in_array($ext, $allowed))
        {
            $created = @date('Y-m-d H:i:s');

            // read image data into a variable for inserting
            $img_data = addslashes(file_get_contents($_FILES['glryimage']['tmp_name']));
                    
            // insert image into mysql database
            $sql = "INSERT INTO tbl_gallery(name, imagedata, created) VALUES('$img_name', '$img_data', '$created')";
            mysqli_query($con, $sql) or die("Error " . mysqli_error($con));
            header("Location: index.php?st=success");
        }
        else
        {
            header("Location: index.php?st=error");
        }
    }
    else
        header("Location: index.php");
}
?>

Well! We have successfully stored image into database. But how to fetch this image from database and show it a page? We'll see it next.

Retrieve and Display Image from MySQL Database

You can retrieve image from mysql like you do with any other data. For example this script will fetch a specific image from the database and display it in a web page.

Displayimage.php

<?php
include_once 'dbconnect.php';
// fetch image from database
$sql = 'select * from tbl_gallery where id=1'; // change this id as per your need
$result = mysqli_query($con, $sql) or die('Error ' . mysqli_error($con));
$row = mysqli_fetch_array($result);
?>
<html>
<head>
    <title>Retrieve Image from MySQL Database in PHP</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" >
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
</head>
<body>
    <div class="container text-center">
        <?php echo '<img src="data:image/jpeg;base64,'.base64_encode($row['imagedata']).'"/>'; ?>
    </div>
</body>
</html>

In order to display image stored in a DB to a web page you have to use image tag rather than printing it directly. Please note that we have stored image as binary data. So you must do proper encoding before displaying the picture, else it won't work.

Done! We have everything in place. Now run 'index.php' file and you will be shown an upload form like this,

upload image to mysql database using php

Now select an image and click 'Upload Image' button. If things go right the image will be inserted into database without trouble and you will be notified like this.

insert image into database php mysql

To display the stored image from database run the script 'Displayimage.php'. It will show the image you have uploaded previously.

display image from mysql database using php

Please note that so many things can go wrong in the middle. So always remember to do proper error handling in your code.

Read Also:

I'm sure now you have better understanding of uploading and displaying images from database using php and mysql. The entire process is uncomplicated and effective than storing images in some server folder. It also saves you from processing through files to retrieve the images. I hope you like this tutorial. Please don't forget to share it in social media. Meet you in another interesting post :)

Top 10 4G Smartphones Under Rs 8000 (Fingerprint Scanner) June 2017

On 6/13/2017 3 Comments so far

Hi! Here is the list of Top 10 4G Smartphones Under Rs 8,000 in India with Fingerprint scanner, 3GB RAM, 4G LTE, OTG, 13MP Camera & Octa Core processor. There are real good mobiles in this price range making your selection process daunting. And the competition is fierce in this price segment with the entry of popular brands like Xiaomi, Coolpad, Lenovo, Intex, YU & Motorola. To help you in buying the best smartphone under 8000 rupees, we have compiled out the list of top ten 4g smartphones under rs 8000 for february 2017 with great specs and very good user experience.

Best Fingerprint Scanner Phones under Rs 8000:

1. Coolpad Note 5 Lite - The Best Fingerprint Sensor Phone

Check Price

fingerprint scanner phone under 8000

Coolpad Note 5 Lite is the best among fingerprint sensor phones under Rs 8000/ with 3GB RAM in india. The smartphone houses 1GHz Mediatek Quad Core Processor, large high definition 5" IPS panel display, 13 MP camera and a good 2500mAh battery. And the best part is it has got 3GB RAM and dual sim with 4G LTE connectivity on both the sim. Overall Coolpad Note 5 Lite includes excellent features at budget price and offers good value for money. The mobile is available exclusively on Amazon and surpasses each one of the expectation of budget buyers.

Key Features:

  • OS: Android v6.0 Marshmallow, COOL UI 8.0
  • Processor: 1GHz MT6735CP Quad Core Processor
  • Memory: 3GB RAM & 16GB Internal
  • Display: 5 inch HD IPS Display
  • Secondary: Expandable Upto 64 GB
  • Camera: 13 MP Rear, 8 MP Front Camera
  • Connectivity: Dual Sim (4G+4G)
  • Battery: 2500mAH Lithium-ion Battery
  • Others: Fingerprint Scanner

Buy From Amazon »

2. Lyf Water 7 - 4G VoLTE Phone

Check Price

phone with fingerprint sensor below 8000 - lyf water 7

Lyf Water 7 is a good choice in fingerprint scanner phones under Rs 8000 range. After recent price slash, Lyf Water 7 is retailing below Rs.8000/ and it's the right time to grab this excellent phone at the cheapest price. The phone has overall excellent specs with support for OTG, 4G VoLTE and Fingerprint Sensor. It packs powerful Snapdragon 616 Octa core Processor, 2GB RAM, 16GB of in-built memory, 5.5 inch Full HD display protected with AGC Dragontrail glass and 13MP Camera.

Key Features:

  • OS: Android v5.1 Lollipop
  • Processor: 1.5 GHz+ Snapdragon 616 Octa-core Processor
  • Memory: 2 GB RAM & 16 GB ROM
  • Display: 5.5 inch FHD, AGC Dragontrail glass
  • Secondary: Expandable up to 128 GB
  • Camera: 13MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE, OTG
  • Battery: 3000 mAh battery
  • Others: Fingerprint Sensor

Buy From Amazon »

3. Lyf Water 7S (3GB) - Premium Smartphone on Budget

Get 36% Discount on Price

fingerprint sensor mobiles under 8000

Here's another one LYF mobile in our recommendations of Budget Smartphones with Fingerprint Sensor. It's really hard to believe we have included this amazing phone on a budget list. But Amazon is running offers and you can grab it at greater dicounted price. The phone has got premium like features including Fingerprint sensor, 3GB RAM, Octa-core Processor, 13MP Camera and 4G VoLTE for fast internet. And it is powered with MediaTek MT6753 Octa Core Processor clocked at 1.3GHz and Android Marshmallow OS.

Key Features:

  • OS: Android v6.0 Marshmallow
  • Processor: 1.3 GHz MediaTek MT6753 Octa Core Processor
  • Memory: 3GB RAM & 16 GB ROM
  • Display: 5.5 inch IPS LCD Display, FHD
  • Secondary: Expandable up to 64 GB
  • Camera: 13MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 2800 mAh battery
  • Others: Fingerprint Sensor

Buy From Amazon » Buy From Flipkart »

4. Swipe Elite Sense - 3GB RAM, 4G VoLTE

Check Price

4g volte fingerprint scanner phone under 8000

Elite Sense is the latest arrival from Swipe family and very good fingerprint scanner phone under 8k segment. The Smartphone comes with excellent features for such a cheaper phone. Together with Qualcomm Snapdragon Quad-core Processor and 3GB RAM it runs all latest games and apps buttery smooth. The finger print sensor is fast and accurate and other features like 32GB Storage, big IPS panel display, 4G VoLTE support are excellent. Only downside is it's average battery which lasts for a day but besides that you get great features, so it makes a good deal.

Key Features:

  • OS: Android 6.0 Marshmallow
  • Processor: 1.4GHz Qualcomm Snapdragon Quad-core Processor
  • Memory: 3GB RAM & 32GB Internal
  • Display: 5 inch IPS HD Display
  • Secondary: Expandable Upto 128 GB
  • Camera: 13MP Rear, 8MP Selfie Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: Li-ion 2500 mAH Battery
  • Others: Fingerprint Sensor

Buy From Flipkart »

5. Micromax Evok Power - 4000mAh Battery & 4G VoLTE

Check Price

phone with fingerprint sensor under 8k

Micromax Evok Power is another good alternative to consider under Rs 8000/ budget. The best part of the phone is the massive battery backup, 4G VoLTE support and Fingerprint sensor. It runs on Android Marshmallow 6.0 and packs 2GB RAM and Quad-core Processor under it's hood for lag-free performance. The compact 5 inch display is very good for single hand operation, comes protected with Gorilla Glass 3 and huge 4000 mAh battery.

Key Features:

  • OS: Android v6.0 Marshmallow
  • Processor: 1.3GHz MediaTek MT6737 Quad Core Processor
  • Memory: 2GB RAM & 16GB Internal
  • Display: 5-inch HD Display
  • Secondary: Expandable up to 64GB
  • Camera: 8 MP Rear, 5 MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 3950 mAh Battery
  • Others: Fingerprint Scanner, Gorilla Glass 3

Buy From Flipkart »

6. Intex Cloud S9

Check Price

fingerprint scanner phones under 8000 -cloud s9

Latest arrival among Intex Cloud series, Cloud S9 is another good option in fingerprint scanner phones under Rs 8000 segment. Priced around 6k, the phone runs on Android Marshmallow 6.0 and powered with 2GB RAM & 64 bit Quad-core Processor clocked at 1.3 GHz. It's one of the cheapest fingerprint sensor phone with 4G VoLTE support and long lasting 3650 mAh battery. Besides it has got 5.5 inch HD screen protected with AGC Dragontrail glass and available in two different colors, Grey and Blue and exclusively on Amazon.

Key Features:

  • OS: Android Marshmallow, v6.0
  • Processor: 1.3 GHz 64-bit Quad Core Processor
  • Memory: 2 GB RAM & 16 GB ROM
  • Display: 5.5 inch HD, Dragontrail glass
  • Secondary: Up to 32 GB
  • Camera: 8MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 3650 mAh Capacity
  • Others: Fingerprint Sensor

Buy From Amazon »

7. Xolo Era 2X - 3GB RAM Smartphone

Check Price

fingerprint scanner phone under 8000

Xolo Era 2X is the latest arrival in the market and another good choice of Fingerprint Sensor Mobile under 8K to go with. The phone is Flipkart exclusive and sports superb features like Fingerprint scanner, 4G VoLTE and the best part is 3GB RAM. It runs on Android Marshmallow OS and powered with 64bit Quad-core Processor accompanied by 16GB storage. If you want to save some bucks on your budget then you can also go for 2GB RAM version which is equally good.

Key Features:

  • OS: Android v6.0 Marshmallow
  • Processor: 64-bit 1.2 GHz MTK6737 Quad Core Processor
  • Memory: 3GB RAM & 16GB ROM
  • Display: 5 inch IPS Display, HD
  • Secondary: Expandable up to 32GB
  • Camera: 8 MP Rear, 5 MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 2500 mAh Battery
  • Others: Fingerprint Sensor

(3GB) Buy From Amazon» (2GB) Buy From Amazon »

8. Panasonic Eluga Ray - 3GB RAM, 4000mAH Battery & OTG

Check Price

3gb ram 4000mah battery fingerprint sensor smartphone

Another latest arrival, Panasonic Eluga Ray is an awesome fingerprint sensor mobile with outstanding battery life and stunning camera features. The Smartphone is a sure winner with huge 3GB RAM, 4000 mAh battery, ample storage, 13MP primary camera and 5MP front camera. The front camera comes with flash which is another big plus of the phone. As for connectivity it offers 4G VoLTE and OTG support.

Key Features:

  • OS: Android v6.0 Marshmallow OS
  • Processor: 1.3GHz Quad core Processor
  • Memory: 3GB RAM & 16GB Internal
  • Display: 5-inch HD Display
  • Secondary: Expandable up to 64GB
  • Camera: 13 MP Rear, 5 MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE Support
  • Battery: 4000 mAh Battery
  • Others: Fingerprint Scanner, OTG

Buy From Flipkart »

9. Swipe Elite Power - 4000mAh Battery Phone

Check Price

fingerprint sensor 4000mah battery phone under 8000

Elite Power is the latest launch from Swipe and best suitable for people who wants marathon battery in their smartphone. The best part of this phone is it's massive 4000 mAh Battery, 4G VoLTE Connectivity and Fingerprint scanner. Rest other features are also equally good for 8k budget. It is fueled with Android v6.0 Marshmallow and powered by Snapdragon Quad-core Processor, 2GB RAM and a large 5.5 inch IPS Screen.

Key Features:

  • OS: Android v6.0 Marshmallow
  • Processor: 1.1 GHz Snapdragon Quad Core Processor
  • Memory: 2GB RAM & 16 GB ROM
  • Display: 5.5 inch IPS LCD Display, HD
  • Secondary: Expandable up to 32GB
  • Camera: 8MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 4000 mAh battery
  • Others: Fingerprint Scanner

Buy From Flipkart »

10. Panasonic Eluga Tapp - Very Affordable Smartphone

Check Price

fingerprint sensor phones under 8000 rs

Panasonic Eluga Tapp is retailing under 6.5k and exclusively available on Flipkart. The phone packs pretty good features for the price like Fingerprint sensor, 4G VoLTE support and decent battery backup. It is powered by 1.25 GHz Quad-core Processor teamed up with 2GB RAM and runs on Android Marshmallow v6.0 OS.

Key Features:

  • OS: Android v6.0 Marshmallow
  • Processor: 1.25GHz Quad Core Processor
  • Memory: 2 GB RAM & 16 GB ROM
  • Display: 5 inch IPS LCD Display, HD
  • Secondary: Expandable up to 32 GB
  • Camera: 8MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 2800 mAh battery
  • Others: Fingerprint Sensor

Buy From Amazon » Buy From Flipkart »

11. Nubia N1 Lite - 5.5" Screen & 4G VoLTE

Check Price

smartphone with fingerprint scanner under 8000

If you like big screen smartphones then you can go for Nubia N1 Lite. The Mobile features 5.5 inch IPS panel display with multi-touch ability. This makes the phone a good fit for internet browsing, gaming and watching movies. Powered with excellent Quad core Processor and 2GB RAM the handset is good at multi-tasking. Plus it offers Fingerprint sensor for security, very good 3000 mAh Battery and 4G VoLTE connectivity for fast internet.

Key Features:

  • OS: Android 6.0 Marshmallow
  • Processor: 1.5GHz Cortex-A53 Quad core Processor
  • Memory: 2GB RAM & 16GB Internal
  • Display: 5.5 inch HD IPS Display
  • Secondary: Expandable up to 32 GB
  • Camera: 8MP Rear, 5MP Selfie Camera
  • Connectivity: Dual Sim, 4G VoLTE
  • Battery: 3000 mAh Battery
  • Others: Fingerprint Scanner

Buy From Amazon »

12. Micromax Canvas Unite 4 Pro

Check Price

top fingerprint scanner mobile under 8000 - unite 4 pro

Coming from the reputed Indian brand Canvas Unite 4 Pro is the latest arrival under 8K segment. This is the Popular 2GB RAM Smartphone in this price range, and runs on Android Lollipop but the good thing is you get Marshmallow upgrade. The phone comes with all latest features such as Fingerprint Scanner, 4G LTE, 1.3 GHz Quad Core processor, 16 GB internal memory and of all a huge 3900 mAh battery for extended battery backup.

Key Features:

  • OS: Android Lollipop, v5.1 (Upgradable to Marshmallow)
  • Processor: 1.3 GHz Quad-Core Processor
  • Memory: 2GB RAM & 16 GB ROM
  • Display: 5-inch HD Display
  • Secondary: Expandable Upto 32 GB
  • Camera: 8MP Rear, 5MP Front Camera
  • Connectivity: Dual Sim, 4G LTE
  • Battery: 3900 mAh Battery
  • Others: Fingerprint Scanner

Buy From Amazon »

Top 4G Smartphones Under Rs 8000:

Lenovo Vibe K5 Plus

Check Price

3gb-ram-4g-smartphone-under-rs-8000-lenovo-vibe-k5-plus

Vibe K5 Plus is the latest arrival from Lenovo and is the best in Top 4G Smartphones under Rs 8000 in India. The smartphone sports all sorts of latest features such as TheaterMax & 4G LTE, popular Snapdragon Octa-core Processor clocked at 1.5GHz coupled with 3GB RAM, 13 MP camera and many more attractive features. Plus it houses 16GB internal memory and runs on Android Lollipop OS. This 4g budget phone comes in two different colors - Silver and Grey and available exclusively on Flipkart

Key Features:

  • OS: Android 5.1 Lollipop
  • Processor: 1.5 GHz Octa Core Processor
  • Memory: 3GB RAM & 16GB ROM
  • Display: 5 inch HD IPS Display
  • Camera: 13 MP Rear, 5 MP Front Camera
  • Connectivity: 4G LTE
  • Battery: 2750 mAh Battery
  • Others: TheaterMax

Buy From Flipkart »

Redmi 3S

Check Price

4000-mah-battery-android-phone-under-8k-redmi-3s

Redmi 3S is the Popular Xiaomi Smartphone under Rs 8000/ and the USP of the phone is it's support for OTG, 4G LTE and long lasting 4100 mAh battery. Another good thing is, it runs on latest Android Marshmallow OS and packs powerful 1.4 GHz+ Snapdragon Octa core Processor, 2GB RAM, 16 GB ROM and 13 MP Camera and many more attractive features.

Key Features:

  • OS: Android Marshmallow
  • Processor: 1.4GHz + 1.1GHz Octa Core Processor
  • Memory: 2GB RAM & 16GB ROM
  • Display: 5 inch HD IPS Display
  • Secondary: Expandable Upto 32 GB
  • Camera: 13 MP Rear, 5 MP Front Camera
  • Connectivity: 4G LTE & OTG
  • Battery: 4100 mAh Battery

Buy From Flipkart »

InFocus Bingo 50 Plus

Check Price

5.5-inch-mobile-with-3gb-ram-below-8000-bingo-50-plus

InFocus Bingo 50 Plus is the successor to the popular Bingo 50 and the best 3GB RAM 4G Smartphone below 8000 rs. For it's asking price, the phone offers so much of attractive specs such as 1.3 GHz Quad-core Processor, 3GB RAM, 5.5-inch HD Screen, Corning Gorilla Glass 3 protection, 13 MP Rear camera and most of all 8MP Front Camera. So for selfie lovers this phone is a great choice and but also quite good for normal phone users too.

Key Features:

  • OS: Android Marshmallow v6.0
  • Processor: 1.3 GHz Quad-core Processor
  • Memory: 3GB RAM & 16GB ROM
  • Display: 5.5 inch HD IPS Display
  • Camera: 13 MP Rear, 8 MP Front Camera
  • Connectivity: 4G LTE
  • Battery: 2600 mAh Battery
  • Others: Corning Gorilla Glass 3

Buy From Amazon »

Lenovo Vibe P1m

Check Price

best-android-smartphone-under-8000-lenovo-vibe-p1m

Lenovo Vibe P1m is a Best Battery Backup Smartphone under Rs 8000 with a huge 3900 mAh battery powering up the phone. The phone is powered by 1 GHz Quad Core Processor together with 2GB RAM and runs on Android Lollipop OS with beautiful VibeUI running on top. Besides it also supports 4G LTE for fast internet connectivity.

Key Features:

  • OS: Android Lollipop, VibeUI 7
  • GPU: Mali-T720 GPU
  • Processor: 1 GHz MediaTek Quad Core Processor
  • Memory: 2GB RAM & 16GB ROM
  • Display: 5 inch HD IPS Display
  • Secondary: Expandable Up to 32GB
  • Camera: 8MP Rear, 5MP Selfie Camera
  • Connectivity: Dual Sim, 4G LTE
  • Battery: 3900 mAh Battery

Buy From Flipkart »

There are other also good options available in Top 10 4G Smartphones under Rs 8000 and comes with great specs with lot of features such as 2GB RAM, Snapdragon Processor, 16 GB ROM, Gorilla Glass Protection and 4G support.

Samsung Galaxy On5

best-samsung-phone-under-8000-galaxy-on5

Key Features:

  • OS: Android v5.1 Lollipop
  • GPU: Mali-T720 MP1
  • Processor: 1.3 GHz Exynos 3475 Quad Core Processor
  • Memory: 1.5GB RAM & 8GB ROM
  • Display: 5 inch HD display
  • Secondary: Expandable Upto 128 GB
  • Camera: 8MP Rear, 5 MP Selfie Camera
  • Connectivity: Dual Sim, 4G
  • Battery: Removable, 2600 mAh Battery

Pros:

  • HD Display
  • Great 5 MP Selfie Camera
  • Light-weight & Slim Design
  • Good battery life
  • 4G Support
  • Brand Value

Cons:

  • Internal Storage
  • RAM

Buy From Flipkart »

That makes our recommendations for top 10 best android phones under 8000 rupees in India.

Last Modified: 13-Jun-2017


Best Desktops for Programming & Developers 2017 - Buyer's Guide & Reviews

On 6/05/2017 Be the first to comment!

Slow computer sucks! Whether you are a newbie developer or a veteran programmer, you already know the necessity of a powerful computer in your profession. Though laptops are portable and easy to carry on your back, nothing can beat up the productivity of a desktop pc. Setting up a perfect workstation at home or office will bring in more discipline to your work. I agree desktop computers are stationary and take up lot of space but it happens to be more ergonomic than a crammed up laptop.

There is no single best computer suitable for all developers. It just boils down to your programming requirements. The best specs and perfect hardware combination should be able to open up your coding opportunities.

However choosing a perfect desktop for programming is not an easy job. You must know what sort of hardware combination is right for your coding demands. To make your job easier I'm going to show you how to pick up the best computer and what are the things to consider in a programming desktop.

Laptop or Desktop? Which is Best?

This question is asked around a lot when buying a new computer. There are so many factors to decide between a desktop and a laptop. It ultimately depends on your lifestyle. Both laptops and desktops have their share of pros and cons.

Laptops take up less physical space and have the advantage of mobility. If you travel a lot and don't work from home or office setup they are the best. You can lug it anywhere you go. But laptops are expensive and deliver lower performance compared to similar-priced desktop.

Plus most of the laptops have small poor-quality keyboards and you don't get the advantage of working in a bigger screen. Trust me! Large displays matters a lot for a programmer.

On the other hand, Desktops are cheaper, comfortable and have better performance - suitable for dual or triple monitor setup. Having a powerful workstation setup vastly improves your productivity. You can conveniently sit and work for extended hours without feeling fatigue or strain. The only downside to desktop is they are NOT portable and takes up lot of space.

Besides Desktop PCs are easy to upgrade and repair. But laptops come with so many smaller parts that you need professional help to repair and upgrade.

As a developer myself, I own both desktop and a laptop, just like most of the programmers. It's good to have a reliable workstation at home and also get the convenience of carrying work in your backpack wherever you go.

Our Top Picks for Best Desktop for Programming in 2017

Here are our top 5 recommendations for programming desktop computers.

1. Dell XPS x8900-7319BLK - The Best Programming Desktop 2017

best desktop pc for programmers

Check Price @ Amazon

Our top pick for the best programming desktop is Dell XPS x8900. Dell brand is reliable and this computer is an ultimate powerhouse. It comes with blazing-fast 6th generation Intel i7 Processor, 24GB of RAM, and huge 2TB of HDD and an additional 256GB of SSD for lightning speed. It's just the right combination to meet up all your programming demands. With ample RAM the desktop handles serious multi-tasking with great ease.

It comes pre-installed with Windows 10 Professional and a discrete NVIDIA GeForce GTX 960 graphics with 2GB of GDDR5 memory for superior graphics. So apart from coding you can also use XPS x8900 for game development, video editing and gaming.

The machine has hybrid storage so I suggest you to install all programs and apps on Solid state drive for fast launching and use HDD to store all your files and work. Plus it has got 6 USB 3.0 ports and 4 USB 2.0 ports which is more than enough for your programming needs.

  • Intel Core i7-6700K up to 4 GHz Processor
  • 24GB DDR4 RAM + 64bit Windows 10 Professional
  • 2TB HDD (7200RPM) + 256GB SSD storage
  • NVIDIA GeForce GTX 960 with 2GB GDDR5 Memory
  • 802.11 AC Wireless connectivity + Bluetooth 4.0
  • Dell KB216 wired keyboard, mouse combo

Get It Now From Amazon


2. Acer Aspire TC-780-AMZKi5 Desktop - Top Budget Desktop for Programming

cheapest desktop for programming

Check Price @ Amazon

Acer Aspire is the cheapest programming desktop computer in our recommendation and gives best value for money. Being Amazon's best seller speaks for its credibility. If you are a budding programmer, computer science major or a programming student with budget-constraint then I highly recommend considering this one.

The PC has the right combination of hardware to deliver power and performance. All your coding work goes smoother with this machine as it comes with 7th generation Intel Core i5 Processor, 8GB DDR4 RAM, huge 2TB Storage and pre-loaded Windows 10 Home OS.

Besides it has integrated Intel HD 630 Graphics to handle all basic gaming and graphics. So unless you are into game development, Acer TC-780 is more than enough to handle all your programming needs.

  • 7th Generation Intel Core i5 CPU
  • 8GB DDR4 RAM + 2TB SATA3 Hard Drive
  • Intel HD Graphics 630
  • 802.11ac Wi-Fi + Bluetooth 4.0
  • Windows 10 Home OS + 8X DVD Writer
  • USB Keyboard and Optical Mouse

Get It Now From Amazon


3. HP Pavilion All-in-One Desktop - Best Touchscreen Coding PC

best developer desktop pc

Check Price @ Amazon

If you don't like desktops taking up too much space then you can go for clutter-free All-in-One computers. All-in-Ones are attractive, touch screen enabled, easy to setup and need less room. HP Pavilion All-in-One Desktop is a powerful combination of latest Intel Core i7 CPU with turbo boost up to 3.6 GHz, 8 GB DDR4 SDRAM which you can expand up to 16GB and Intel HD 530 GPU for handling graphics.

If you feel 8GB Memory is not enough you can always upgrade it to 16GB at any time. And the best part is the big 23.8 inch widescreen Full HD IPS Panel display which is touch enabled. The thin almost bezel-less display makes the desktop very attractive.

It also has built-in Bluetooth 4.0 support which is the latest technology and has HP TrueVision Web Camera, Ultra Slim SuperMulti DVD Burner, wireless keyboard and mouse. Overall it's a complete package that is efficient to meet up every coding demands of a programmer.

  • Intel Corei7-6700T up to 3.6 GHz Processor
  • 23.8-inch IPS FHD Touchscreen Display
  • 8GB DDR4 SDRAM + 1TB SATA Hard Disk
  • Intel HD 530 Graphics Card
  • HD Webcam + Microphone + DVD Writer
  • Wireless Keyboard + Optical Mouse
  • Windows 10 64-bit

Get It Now From Amazon


4. Lenovo IdeaCentre 700-25ISH Desktop - Mid-Range Programming + Game Development Desktop

best desktop for programming and gaming

Check Price @ Amazon

Lenovo IdeaCentre 700 is another good pc computer for developers. It comes with the configuration suitable for heavy duty processing and gaming. It comes pre-loaded with Windows 10 OS and is powered with Skylake Intel Core i7 3.4 GHz Processor coupled with 8GB RAM and deliver smooth performance and effortless multi-tasking.

There is huge 1TB HDD storage plus additional 120GB of Solid State drive. The best part of this desktop is that Operating system is installed in SSD so literally it takes up only few seconds for booting Windows 10.

The desktop comes with a really good dedicated graphics card with 2GB video RAM. The NVIDIA GeForce GTX 960 Graphics is more than enough to run latest graphics softwares and game engines without hassle. Overall Lenovo IdeaCentre has all the power and elegance to meet up the demands of a programmer & game developer with more room for upgrades and expansion.

  • 3.4 GHz Intel Core i7 6700 Processor
  • 8GB DDR4-SDRAM + Windows 10 OS
  • 1TB HDD + 120GB Solid State Drive
  • NVIDIA GeForce GTX 960 (2GB) Graphics Card
  • DVD Read/Write Optical Drive

Get It Now From Amazon


5. Alienware AUR5-12571SLV Desktop - Best Game Development Computer

best computer for game development

Check Price @ Amazon

Alienware AUR5-12571SLV is a high-end VR Ready desktop with lightening fast performance. The machine is powered with 6th generation Intel Core i7 3.4GHz Processor teamed up with 16GB DDR4 RAM with more room for expansion up to 64GB RAM.

It comes pre-installed with Windows 10 OS and got 2TB of hard disk space to store all your files and projects. Plus there is also another 256GB SSD storage for fast loading OS and Programs.

As for GPU, Alienware AUR5 has the excellent NVIDIA GeForce GTX 1070 with 8GB GDDR5 Memory which makes it the best desktop for Virtual Reality and Game Developers. Hard-core gamers are going to have great time with this beast.

Overall it's a great pc and little expensive but worth every penny you spend. Highly suitable for Professional developers and programmers.

  • Intel Core i7-6700 3.4GHz Processor
  • 16GB DDR4 RAM, Expandable up to 64GB
  • NVIDIA GeForce GTX 1070 with 8GB GDDR5 vRAM
  • 2TB 7200RPM HDD + 256GB M.2 PCIe SSD
  • Dual layer DVD Burner + Windows 10 Home

Get It Now From Amazon


How to Choose the Best Desktop for Programming?

Should You Get SSD or HDD Storage?

If you don't have patience to sit and watch your computer taking up ages to open up a file or program then do you yourself favor and get SSD. You won't regret it.

HDD drives are cheaper and you get so much of space at lower price. But the problem is they are slow. The more data you store the more slower it is. The entire process is mechanical. It has this small moving head that spins and sorts through several millions of bits of data stored in the disk every time you try to access a file, folder or program.

But SSD or Solid State Drive is super fast since it has no mechanical parts. It literally boots up a computer within seconds and loads up mega files and heavy programs at lightning speed. They are expensive but well-worth the price. Together with Powerful Processor, Good RAM and SSD your system will chew up any task you throw at it.

These days' computers happen to have hybrid storage that is with both HDD and SSD drives. I highly recommend going for this type of storage if you can afford it. By this way you can get to store all static files and Medias in HDD and install Operating system and Programs on SSDs for faster performance.

Processor: How Many Cores Do You Need?

The Processor or CPU (Central Processing Unit) is the brain of your computer and the driving force behind every task your system performs.

Your desktop/laptop performance relies on CPU. The two most important things you must consider about a processor are speed and number of cores.

Most of the latest processors are tuned out for faster performance. So if you go for Intel chipset you don't have to worry much about speed. They will be at best. But the number of cores is a different story. Most of the time number of cores is related to speedy performance. This is not entirely true. Their main purpose lies on the level of multi-tasking they accomplish.

We programmers are used to open up multiple applications, browser windows, several files and tabs during work. This increases work load on CPU. A CPU like Intel i7 with four-cores will meet up all your coding demands without trouble.

Unless you are on tight-budget I suggest you to go with i7 or i5 processor. On any case if you have to settle for Processor with two cores, just make sure it is capable of hyper threading which will be OK for multi-tasking.

How Much RAM is Optimal?

RAM is another one important factor to consider. RAM or Random Access Memory keeps tab of all opened applications, files etc and data related to them for easy access. So having a good amount of RAM is a must if you don't want a lagging pc. Just a bloated IDE and 8 to 10 Chrome tabs are enough to slow-down a computer. So I would recommend going for at least 8GB RAM - NEVER settle for anything less than that.

RAM is relatively cheap so going for 16GB or even 32GB won't hurt. This helps in case you work on GPU intensive tasks such as game development. Game engines do need more power.

Generally there is a misconception about 'More RAM' equals 'More Speed'. This is not completely true. Just keep in mind, doubling RAM won't double the speed. Having 32GB RAM with low-end processor doesn't boost up performance of a computer. At the same time a 4-core high-end processor with 16GB RAM will do wonders.

Do You Need A Graphics Card?

Gone are the times when we programmers sit and do only coding. Now everyone has to do everything. I know several developers who do designing stuffs too. For some it's a hobby, some its passion and others simply work.

A Graphics Card or GPU takes care of rendering images to screen and comes with separate video RAM for processing data into signals. Modern Processors like Intel i5, i7 has built-in integrated graphics which is efficient to some level. This type of graphics card doesn't have separate memory so they'll make use of system RAM for handling games and graphics. As a coder you can get away with this and don't need a dedicated GPU.

But if you are into desktop gaming or occasionally work with graphics softwares like Photoshop then you'll need a discrete GPU on your desktop.

As for Game Developers you MUST have a high-end Graphics card for rendering images. Just an integrated graphics won't cut it. The better your graphics card the better and smoother the rendering is. This is very important for game developers, graphics artists, gamers and video editors.

NVIDIA is the most popular graphics card with AMD cards lining next. If at all you have to choose a dedicated graphics card, I recommend you to go for NVIDIA card with at least 2GB vRAM.

What about Display & Keyboard?

Computer Display and Keyboard is what you call as comfort feature. I like large screen monitor and mechanical keyboard. Since this is what you are going to do all day as a programmer, sit and look into the monitor and type into the keyboard.

Big display is the luxury you get with Desktops. You can't expect such thing with a laptop. A wide monitor can accommodate so much screen elements in one go and you don't have to squint your eyes to read through tiny texts. A well-spaced super responsive keyboard will prevent strain on your wrist and fingers. I must say mechanical keyboards are the BEST in this context.

Over To You:

That concludes our buying guide on best desktop computers for programmers and developers. The desktops reviewed here are very good for programming and coding needs and suitable for everyone's budget. I hope now you have better understanding of what to look for and already found a great desktop for coding purpose. If you have any good suggestions please leave it in the comment section.

Also Read:

Add, Update, Delete and Read JSON Data/File in PHP

On 5/29/2017 Be the first to comment!

Hi! Today let's see about JSON CRUD with PHP. Yep! Manipulating json data - add, update (edit), delete and read json file using php script. JSON is everywhere these days. With increasing popularity of APIs it's a must for a developer to know how to read, parse and manipulate json data. If you wonder what the connection between API and JSON is, almost all modern APIs lean towards REST and they provide response as JSON. (In KodingMadeSimple.com I have covered json topics a lot earlier and you can visit our JSON Tutorials section to learn more about working with JSON format.)

php add edit delete read json file

JSON is the string notation of JavaScript object. It takes up simple to complex forms and stores data as (key, value) pairs.

This is the example of a json file.

Read Also:

results.json

[
    {
        "Code": "1",
        "Name": "June Zupers",
        "Sports": "Base Ball"
    },
    {
        "Code": "2",
        "Name": "Fred Cortez",
        "Sports": "Soccer"
    },
    {
        "Code": "3",
        "Name": "Kevin Burks",
        "Sports": "Tennis"
    }
]

Now let me show you how to read and parse through above json file using php.

Read JSON File in PHP:

To read json file with php, you must first get the json data stored in the file, decode json and finally parse through the array or object.

For that you'll need two php functions - one is file_get_contents() and the other is json_decode().

<?php
// load file
$data = file_get_contents('results.json');

// decode json to associative array
$json_arr = json_decode($data, true);

foreach ($json_arr as $key => $value) {
    echo  $json_arr[$key] . " - " .  $json_arr[$value] . "<br/>";
}
?>

If you know the specific key name, then you can simply access it like this,

echo $json_arr[0]['Code'];

Note: The function json_decode() decodes the given json string into an array or object. For example the statement json_decode($data, true); in above code will return associative array. You can ignore the second parameter 'true' to make it return as an object.

Add to JSON File in PHP:

To add additional records to json file you have to simply append it to the end of file. Here let's see an example for adding new data. The following php snippet takes up a json file, decode it, add extra records and again encode to json and save it into a new file.

<?php
// read json file
$data = file_get_contents('results.json');

// decode json
$json_arr = json_decode($data, true);

// add data
$json_arr[] = array('Code'=>4, 'Name'=>'Jeff Darwin', 'Sports'=>'Cricket');

// encode json and save to file
file_put_contents('results_new.json', json_encode($json_arr));
?>

results_new.json

[
    {
        "Code":"1",
        "Name":"June Zupers",
        "Sports":"Base Ball"
    },
    {
        "Code":"2",
        "Name":"Fred Cortez",
        "Sports":"Soccer"
    },
    {
        "Code":"3",
        "Name":"Kevin Burks",
        "Sports":"Tennis"
    },
    {
        "Code":4,
        "Name":"Jeff Darwin",
        "Sports":"Cricket"
    }
]

Update JSON File PHP:

As for updating json file you can either modify single value or in bulk. Here's an example for modifying value for a specific json attribute.

<?php
// read file
$data = file_get_contents('results.json');

// decode json to array
$json_arr = json_decode($data, true);

foreach ($json_arr as $key => $value) {
    if ($value['Code'] == '2') {
        $json_arr[$key]['Sports'] = "Foot Ball";
    }
}

// encode array to json and save to file
file_put_contents('results_new.json', json_encode($json_arr));
?>

Here's what the script does.

  • Load results.json file to a variable
  • Decode json data to array
  • Loop through the array and check if key 'Code' is '2'
  • And edit the corresponding 'Sports' value to 'Foot Ball'

results_new.json

[
    {
        "Code":"1",
        "Name":"June Zupers",
        "Sports":"Base Ball"
    },
    {
        "Code":"2",
        "Name":"Fred Cortez",
        "Sports":"Foot Ball"
    },
    {
        "Code":"3",
        "Name":"Kevin Burks",
        "Sports":"Tennis"
    }
]

Delete JSON Data from File:

JSON deletion is little complex since it is easy to mess up doing the process. You must be clear what you need to delete first, a specific key pair from all rows or a complete row.

For example this php script will delete entire record from json containing key 'Code' as '2'.

<?php
// read json file
$data = file_get_contents('results.json');

// decode json to associative array
$json_arr = json_decode($data, true);

// get array index to delete
$arr_index = array();
foreach ($json_arr as $key => $value)
{
    if ($value['Code'] == "2")
    {
        $arr_index[] = $key;
    }
}

// delete data
foreach ($arr_index as $i)
{
    unset($json_arr[$i]);
}

// rebase array
$json_arr = array_values($json_arr);

// encode array to json and save to file
file_put_contents('results_new.json', json_encode($json_arr));
?>

And this is the file we get after deletion.

[
    {
        "Code":"1",
        "Name":"June Zupers",
        "Sports":"Base Ball"
    },
    {
        "Code":"3",
        "Name":"Kevin Burks",
        "Sports":"Tennis"
    }
]

The deletion script uses two foreach loops. The first one is for determining the array index we need to delete from json.

And the second is what actually deletes from array using unset() function.

Finally it rebases the array, encode it to json and store it in a new file.

Read Also:

Likewise you can add, edit, delete and read json file in php. It's easy to mess up with json and so many newbies confuses json and actual javascript object. JSON can get complex if it uses nested structure and you'll have real trouble manipulating it. Only constant practice will get you there and it's easy to master it in my opinion.

I hope you like this tutorial. Please don't forget to share it with your friends.

Best 7 jQuery File Upload Plugins (Drag and Drop, Progress Bar)

On 5/23/2017 Be the first to comment!

Hi! Here's some of the best jquery file upload plugins for your next project. Implementing file uploading is one big headache as you have to take care of things like security; handling multiple uploads, dealing with too large files etc. And then there's this user experience sort of things like drag and drop, progress bar and providing file preview. Overall you have to sort out so many things during uploading process. If you don't want to go through all these hassle then use any one of the readily available jquery file upload plug in.

Below we have handpicked some of the best file upload plugins in jquery to make your life easier. They come with so many customizing options and let you integrate beautiful file uploader to your websites quickly and serve rich user experience.

best jquery file upload plugins with progress bar

7 Best jQuery File Upload Plugins:

1. Uploadify

Read: Drag and Drop Multiple File Upload in jQuery & AJAX

Uploadify plug-in let you integrate multiple file upload functionality to your website easily. This file upload plugin offers extreme customization and available as both HTML5 and Flash versions for you to choose from. What we like most is the ability to upload multiple files without clustering the page with numerous browse buttons, real-time progress bar and drag-drop support with HTML5 version.

Key Features:

  • Multiple file upload without multiple browse buttons
  • Drag and drop files to upload queue
  • Real time progress bar to show uploading status
  • Highly Customizable to suit your need
  • Restrict uploads based on file size, type, quantity etc

Visit Website

2. Droply JS

Droply is a light-weight responsive jQuery based plug-in to setup single or multi-file upload feature to websites. As a developer your time is precious, so using droply.js will give you the leverage to add beautiful and professional file uploader to websites without going through the hassle of implementing everything from scratch. The highly configurable settings and ease-of-use makes it a remarkable file uploader plug in.

With Droply users can easily upload extremely large files of several giga-bytes with ease as it employs the latest chunk upload technique. And the best part is its minimal size without comprising rich features it offers. It is written in pure jquery so compatible with all platforms.

Key Features:

  • Responsive multi-file uploader
  • Drag and drop Files support
  • Delete files from upload queue
  • Employs smooth CSS3 effects
  • Progress indicator & file preview options
  • Compatible with Android and iOS

Visit Website

3. Plupload

Plupload is another great choice if you need a file uploader with ready to build User Interface. It is based on HTML5 APIs and offers limited customizations. But Flash and Silverlight fallbacks, numerous readily available themes and multi-lingual packs makes it worth trying. Plus it uploads files in chunks and let you bypass any server limitation on uploading bigger files.

Read: jQuery Drop Down List with Search Example

Key Features:

  • Multi-uploader using HTML5 APIs
  • Drag-and-Drop file support
  • Instant thumbnail preview
  • Shrink Images on Client-Side to save bandwidth
  • Upload in Chunks to support large files
  • Support for 30+ languages

Visit Website

4. FineUploader

FineUploader is a flexible library written in pure JavaScript but available as jquery plugin too. It includes all sorts of basic functionalities you require in a file uploader plugin like single/multiple file uploads, drag and drop files, real-time progress indicator and file preview options. What if you have uploaded a wrong file? Well! With fineuploader you get a nice option to delete uploaded files.

Besides the plug-in offers so many interesting features like pause & resume uploads, file partitioning, entire folder uploading, image scaling, uploading directly to cloud like Amazon S3 or Microsoft Blob Storage service etc.

Key Features:

  • Pause, Resume & Retry Uploads
  • Cancel uploads in the middle
  • Support for Cloud uploading
  • Delete already uploaded files
  • File Chunking / Partitioning
  • ES6 modules & CommonJS Support
  • Upload from mobile camera

Visit Website

5. jQuery File Upload

jQuery File Upload is another good jquery plugin for simplified file uploading and saving. It offers versatile range of options supporting multiple file upload, drag and drop feature, status bar indicator, file preview and much more. Plus you can cancel and resume upload at any time. It also supports uploading large file in chunks and let you edit and resize images after uploading.

jQuery File Upload Plug in is cross-domain compatible which is another good reason to go for. It works with all sorts of server platforms like PHP, Python, Java, Node.js, Ruby on Rails etc that supports standard HTML file uploads.

Key Features:

  • Multiple file uploads
  • Drag & Drop files
  • Progress bar Support
  • Cancel/Resume uploads
  • Image resizing via JS APIs
  • Preview images/audio/video
  • Highly configurable & extendable

Visit Website

6. DropzoneJS

Dropzone is an open source library that turns out any HTML element into a potential dropzone area. It employs AJAX technology and let user drag and drop files onto it for uploading. The library is extremely light-weight and written on pure java script. Includes so many nice features like multiple uploads, progress bar, image preview & resize, configure file limits, rename file during uploads etc.

Dropzone is compatible with browsers like Chrome, Firefox, IE, Safari, Opera but not work in older versions which doesn't support drag’n’drop. So make sure to check for browser compatibility.

Key Features:

  • Multiple files & synchronous uploads
  • Progress bar indicator
  • Support for big files
  • Drag-and-drop
  • Image Preview
  • Enabled Retina

Visit Website

7. Bootstrap File Input

If you need something to work with Bootstrap then this is for you. Bootstrap File Input Plugin works with Bootstrap 3.x and an enhanced version of standard HTML5 file element with multiple file selection, preview support for various types of files such as html, image, audio, video, flash and objects. Further you can simply drag and drop files for uploading, preview, add and delete uploaded files. It is based on AJAX and relies on Bootstrap CSS3 styles.

Key Features:

  • Multiple File uploads
  • Drag and drop
  • Multi-file preview
  • Multi language widgets
  • Image Resizing
  • Configurable layout & style

Visit Website

Also Read:

Best Kali Linux Compatible Wireless Adapters/Dongles 2017

On 5/22/2017 Be the first to comment!

Here are the best kali linux compatible wireless adapters and usb dongles for 2017. Kali Linux is a Linux distribution mainly used for Penetration Testing, accessing N/W Security & Ethical Hacking. The process of choosing a wireless adapter or usb dongle to work with Kali Linux is not an easy task. It's just because the Operating system doesn't support all kinds of wifi adapters.

For example Pentesting requires a card to go into monitor mode and do packet injection which all cards can't do it. The Card's chipset and drivers is what determines if an adapter is compatible with kali or not.

Below I have listed out the most popular chipsets for Kali linux and Wireless adapters compatible with them. They work well for Penetration testing too.

Popular Kali Linux Compatible Chipsets:

  • Atheros AR9271
  • Ralink RT3070
  • Ralink RT3572

Best Kali Linux Compatible Wireless Adapters:

1. Alfa AWUS036NHA (Atheros AR9271 Chipset Compatible)

Check Price

Alfa-AWUS036NHA

Alfa AWUS036NHA is a best wifi adapter for pentesting. For wireless penetration testing, Atheros AR9271 is a good chipset and you can go for Alfa AWUS036NHA card if you plan to run Kali as VM. Just get the job done without hassle.

  • Compatible with any 802.11b, 802.11g or 802.11n routers using 2.4Ghz band
  • Supports multiple input multiple output
  • High speed transfer TX data rate of up to 150 mbps
  • Includes 4" detachable antenna of 5 dbi which can be upgraded up to 9 dbi.
  • Works with 64/128-bit wep, wpa, wpa2, tkip, aes security protocols.
  • Supports Windows 2000, XP 32/64, vista 32/64 & Windows 7 Platform. So compatible with Kali Linux running as VM on these hosts.

Get It Now From Amazon »

2. TP-Link TL-WN722N (AR9271 Chipset Compatible)

Check Price

best wifi card for kali linux

Another great wireless adapter for cheapest price. TP-Link TL-WN722N uses AR9271 Chipset and has great range of up to 150Mbps. The card is easy to set up and works perfectly with Kali Linux.

  • Supports Wireless speed of up to 150Mbps
  • Works both on Infrastructure and Ad-Hoc Mode
  • Includes a detachable 4dbi omni directional antenna
  • Supports WPS & USB 2.0
  • Compatible with Windows XP, Windows Vista, Windows 7, 8, 8.1 platforms

Get It Now From Amazon »

3. Alfa AWUSO36NH (RT3070 Chipset Compatible)

Check Price

best alfa wifi adapter for kali

One of the best compatible usb wireless adapter for kali linux. This 2 Watt 802.11n compatible Wifi adapter is quite powerful and supports Ralink RT3070 Chipset. The dongle has very good range and perfect for packet monitoring.

  • Compatible with any 2.4GHz routers of 802.11n, 802.11b/g/n wireless standards
  • Includes removable 4" - 5 dBi antenna and can be be upgraded up to 9dBi
  • Supports 64/128-bit WEP, WPA, WPA2, TKIP, AES Protocols
  • Compatible with Windows 2000, XP 32/64, Vista 32/64, Windows 7, Linux (2.4.x/2.6.x),and Mac (10.4.x/10.5.x)

Get It Now From Amazon »

4. Alfa AWUS036NEH (RT3070 Chipset)

Check Price

Alfa-AWUS036NEH

This is Wi-Fi Dongle is similar to Alfa AWUSO36NH in specs and covers long range. Alfa AWUS036NEH is exceptional for penetration testing and is good at packet injection and monitoring.

  • Works well with any 802.11b/g and 'N' routers
  • Includes removable 4" 5dBi antenna (upgradable up to 9dBi)
  • Supports packet injection & monitor mode
  • Protocols supported - 64/128-bit WEP, WPA, WPA2, TKIP, AES
  • Compatible with Windows 2000, 32/64 bit XP, Vista, Windows 7, Linux (2.4.x/2.6.x), Mac (10.4.x/10.5.x) Power PC& PC.

Get It Now From Amazon »

5. Panda PAU05 (RT3070 Chipset)

Check Price

Panda-PAU05

Panda 300mbps wireless n usb adapter is very reasonably priced and works with 802.11g/n standard and offers a data speed of up to 300 Mbps. It is exceptionally good considering the price but make sure to download and install the latest driver (alone) for Windows 7 and leave the rest of the setup to Windows itself.

  • Compatible with any 802.11g or 802.11n 2.4Ghz wireless routers
  • Wireless speed of up to 300Mbps
  • Works with both infrastructure and ad-hoc modes
  • Security protocol compliant: 64/128bit WEP, WPA, WPA2, 802.1x and 802.11i, Cisco CCS V1.0, 2.0 and 3.0
  • Supports 32/64-bit Windows 8/7/Vista, Mac OS 10.4/10.5/10.6/10.7/10.8/10.9 and latest version of 32/64-bit Mint, Ubuntu, Fedora, openSUSE, etc.

Get It Now From Amazon »

6. Alfa AWUS051NH (Ralink RT3572 Chipset)

Check Price

Alfa-AWUS051NH

Alfa AWUS051NH is little expensive but has amazing signal reception and works well on Kali and in 5Ghz Monitor mode.

  • It is compatible with 802.11n draft 3.0, 802.11a/b/g wireless standards
  • Work with 2.4GHz and 5.8GHz band and MIMO (Multiple Input Multiple Output)
  • Supports wireless transfer RX data rate of up to to 300 Mbps
  • Allows wireless data encryption with 64/128-bit WEP, WPA, WPA2, TKIP, AES Protocols
  • Compatible with Windows 2000, 32/64 bit XP & Vista, Linux (2.4.x/2.6.x), Mac (10.4.x/10.5.x) Power PC& PC.

Get It Now From Amazon »

Over To You:

So these are the best wireless adapters and usb dongles for kali linux. Though all these adapters works well with Kali, just make sure if it is the right one for your environment. For example if you wish to run Kali on Virtual box in Windows 7 host then make sure the card is compatible with Windows 7 OS. Also you must be cautious about the coverage range. Antenna with bigger dBi would be better for longer range. This helps you avoid future trouble. If you find this useful please share it with others to give them good suggestion.

Also Read:

Delete ALL Files and Subfolders from Folder in PHP

On 5/16/2017 1 Comment so far

Hi! Today let's see how to delete all files and sub-folders from a folder using php. If your website allows user uploaded contents then I bet you might want to do regular clean ups to free up more space in web server. Like deleting all files of a user without activity for long time, deleting files older than 3 months etc. Whatever the reason, doing such clean-up manually is a tedious task. You can accomplish it with the help of an automated php script. And I'm going to show you here exactly how to delete directory and all files and sub directories from it with php.

php-delete-all-files-and-subfolders-from-folder

Delete All Files from Folder in PHP:

As for deleting all files from a folder the process is pretty straight forward. You only need two native php functions glob() and unlink() to achieve this.

  • Function glob() returns an array of filenames/directories matching the given pattern.
  • Function unlink() deletes a given file.

Our process goes like this - you have to loop through the files one by one from a given folder, check if it is a file and delete file with the help of unlink() function. Here is the simple php function I have written to delete all files from a directory.

PHP Function to Delete All Files from Folder:

<?php
// delete all files from folder
function deleteFiles($dir)
{
    // loop through the files one by one
    foreach(glob($dir . '/*') as $file){
        // check if is a file and not sub-directory
        if(is_file($file)){
            // delete file
            unlink($file);
        }
    }
}
?>

Usage:

<?php deleteFiles("test"); ?>

As you can see in function deleteFiles() we have used the pattern '/*' to instruct glob() to get all the files names from the folder.

Next we loop through the files one by one and check if the item is a file and not a sub folder itself using is_file() function.

Once we confirm it as a file we delete it with unlink() method. The process will be repeated until no file is left in the specific folder.

Delete Only Particular File Type from Folder:

Say you don't want to remove all files, just the pdf files alone from a folder. Then here's the script for the task.

<?php
// delete all pdf files from folder
function deleteFiles($dir)
{
    // loop through the files one by one
    foreach(glob($dir . '/*.pdf') as $file){
        // check if is a file and not sub-directory
        if(is_file($file)){
            // delete file
            unlink($file);
        }
    }
}
?>

Delete Files Older than X Days from Folder:

This is another useful variation of the script. Suppose you want to delete older files say of at least 90 days old. You have to simply check if the last modified date and time of the file is greater than 90 days and delete if it is.

<?php
// delete all files older than 90 days
function deleteFiles($dir)
{
    // loop through the files one by one
    foreach(glob($dir . '/*') as $file){
        if(is_file($file)){
            // check if file older than 90 days
            if((time() - filemtime($file)) > (60 * 60 * 24 * 90))
                unlink($file);
        }
    }
}
?>

To check if files are older than 90 days, we have used filemtime() to get last modified timestamp of a given file, took its difference from current timestamp and checked it against 90 days count.

Delete All Files and Sub Folders from a Folder in PHP:

So far we have seen about deleting just files present in a directory. What if you have sub directories with files inside the folder. In such case the above script won't work. You'll need to create recursive function to delete all files, sub-directories and parent directory altogether.

Simply deleting a folder with rmdir() won't work. It will throw exception if you attempt to remove folder with files in it. So first you have to delete files one by one from each sub folder plus the rest of the files and then delete folders by removing parent folder.

Here is the php recursive function to delete files and sub folders from the folder.

<?php
// delete all files and sub-folders from a folder
function deleteAll($dir) {
    foreach(glob($dir . '/*') as $file) {
        if(is_dir($file))
            deleteAll($file);
        else
            unlink($file);
    }
    rmdir($dir);
}
?>

Function Usage:

<?php deleteAll("test"); ?>

It will take care of deleting all files, sub folders from a folder automatically.

You can use the above php script to delete files and sub-directories in a given folder programmatically. The script is relatively fast but it depends on the amount of files and folders to be deleted. I hope you find this tutorial useful. Meet you in another interesting one :)

Contact Form

Name

Email *

Message *