Upload Image with PHP and Jquery Using Form

Hello Friends,

In this blog post, I am going to show an existing functionality of image upload using a form with the help of PHP and jquery.

Often you would have seen the option of image upload while filling your college, office, interview form. Here you upload your image and submit with the form.

this functionality is very important once we have to collect the image of our users and any other things depend on the context of the requirement.

You can also use this image upload functionality as your school project and show it as a collection of images would also take over to form an image gallery.

So How to build this functionality?

Friends, this is a very simple to build just follow the below-given procedure step by step and you will be finished with an image upload code or software.

Software used for building this project:

Net Beans IDE
Xampp Server

We used this above software for this project though you can use any software supporting PHP, HTML, Jquery or that you are familiar with.

File Structure:

See the image below.


As per the above file structure, you just make a PHP project name as image upload or you can have any name as per your requirement.

Now create all the files as shown in the above file structure. You can rename the pages but make sure to change the same in the code given below.

You will also need to create one folder name as upload folder. See the file structure image for the same.

You will also need to download one delete icon image and copy it to your project.

Now just place this below-given code into the respective files and run your project by running the upload.php file.


<!DOCTYPE html>
<title>Upload Image using form</title>
<link href="style.css" rel="stylesheet">
<script src=""></script>
<script src="imageupload.js"></script>
<div id="mainform">
<div id="innerdiv">
<h2>Upload Image using form</h2>
<!-- Required Div Starts Here -->
<div id="formdiv">
<h3>Upload Image Form</h3>
<form action="" enctype="multipart/form-data" id="form" method="post" name="form">
<div id="upload">
<input type="file" name="file" accept="image/*">
<input id="submit" name="submit" type="submit" value="Upload">
<div id="detail">


<li>You can upload only- <b>(jpeg,jpg,png) images.</b></li>
<li>Image size < 100kb.</li>
<div id="clear"></div>
<div id="preview">
<img id="previewimg" src=""><img id="deleteimg" src="delete.png">
<span class="pre">IMAGE PREVIEW</span>
<div id="message">
<?php include 'imageupload.php';?>



if (isset($_POST['submit'])) {

$validextensions = array("jpeg", "jpg", "png");
$temporary = explode(".", $_FILES["file"]["name"]);
$file_extension = end($temporary);

if ((($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/jpeg")
) && ($_FILES["file"]["size"] < 100000)//Approx. 100kb files can be uploaded.
&& in_array($file_extension, $validextensions)) {

if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br/><br/>";
} else {

echo "<span>Your File Uploaded Succesfully...!!</span><br/>";
echo "<br/><b>File Name:</b> " . $_FILES["file"]["name"] . "<br>";
echo "<b>Type:</b> " . $_FILES["file"]["type"] . "<br>";
echo "<b>Size:</b> " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "<b>Temp file:</b> " . $_FILES["file"]["tmp_name"] . "<br>";
if (file_exists("upload/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " <b>already exists.</b> ";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
$imgFullpath = "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER["REQUEST_URI"].'?').'/'. "upload/" . $_FILES["file"]["name"];
echo "<b>Stored in:</b><a href = '$imgFullpath' target='_blank'> " .$imgFullpath.'<a>';


} else {
echo "<span>***Invalid file Size or Type***<span>";


$(document).ready(function() {
// Function for Preview Image.
$(function() {
$(":file").change(function() {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
function imageIsLoaded(e) {
$('#message').css("display", "none");
$('#preview').css("display", "block");
// Function for Deleting Preview Image.
$("#deleteimg").click(function() {
$('#preview').css("display", "none");
// Function for Displaying Details of Uploaded Image.
$("#submit").click(function() {
$('#preview').css("display", "none");
$('#message').css("display", "block");


@import "";
/* Above is to load Google Fonts in our page.*/
margin:30px auto;
font-family:'Droid Sans',sans-serif
#mainform h2{
padding:10px 30px 30px
box-shadow:0 1px 1px 1px gray;
margin:50px 0 0;
border:1px solid #fff;
box-shadow:0 1px 1px 0 #a9a9a9;
border:1px solid #e4d3c3;
box-shadow:0 0 10px grey;
#message span{
margin:15px 85px 0 0

In a case of any queries, you can write us at we will get back to you ASAP.

Hope! you would have enjoyed this post.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!



Hello Friends,

In this blog post, I am going to explain how to enable the payment in Google Adsense.

This could be a very interesting post for those who are struggling to enable their Google Adsense payment after reaching the address verification threshold.

As it has been observed that many of us get mess up with the problem of enabling the Google Adsense payment.

Once you reach the Address verification threshold that is $10 then Google Adsense send you an address verification pin and in your account, you can see the notification like “Your payment is on hold  just verify your address” whereas some people might see two notification one for address pin verification and another for identity verification as this depends on place to place or country.

For enabling the Google Adsense payment you may either verify the address or both address and identity, this depends on your place of living or country.

Before going in depth-first I want to let you know about the threshold, there two types of threshold in Google Adsense, which are explained below.

1. Address verification threshold

Once you join the Google Adsense program then they send an address verification pin to the given address at your AdSense account once you reach your address verification threshold that is $10, this might be changed as per google updates.

That means once your Adsense income becomes $10 then google send an address verification code by post to your given address at Adsense. Once you receive that pin then you have to enter that pin code into your Google Adsense account.
Once you enter the correct pin your address will be verified in a short time.

2. Payment threshold

By default,t google sets a $100 minimum payment threshold that means you can’t withdraw your money until you reach this amount of $100 though you can set your own thresholds which must be more than this as per your requirement.

So above we explained about the types of Google Adsense threshold. Now to get your payment from Google Adsense will this address verification be sufficient?

See, this depends on your location and your country too. for someplace,s address verification is sufficient to verify there is no need to verify the identity.

But in few places, identity verifications are also required to be done for enabling your payment through Google Adsense.

What is this identity verification and how does it happen?

this is very simple verification which is to be done just by uploading your one of your ID approved by your country government such as driving license, voter ID and etc.

This verification is also an alternate option when a user does not get the address verification pin in all given attempt from Google Adsense. Then they are given the chance to upload their ID and verify the account.

This identity verification is compulsory in few places or country whereas in few places address verification is just enough to verify. Bu in a case where you don’t receive the address verification code in all given attempt of pin generation then you have this alternate option to verify your identity to enable your Google AdSense payment.

What is the total no. of attempt that Google Adsense provides for pin generation?

they provide total 3 attempts to generate the pin and send them to your postal address. You can change your address as per your help where you can easily get the pin or your postman can easily reach. Make sure you enter the best address where your post can reach easily. it is not compulsory that your address should match the address of your ID card.

But if you don’t receive the address pin in all the given attempt then you get the chance to upload your Identity card at this time make sure you keep the same address of your Google Adsense account as well as your identity card, So that there would not be any misconception with your identity. But if you receive your address pin from post then there is no need to keep the same address on your ID card and Adsense account as they just check the name in priority.


How much time Adsense provide to enter the address verification code?

It is 4 month now, once your pin is generated then you have four months to enter that pin in your Adsense account from the date of pin generation.

The first time the PIN is generated by Adsense once you reach the threshold of $10 for address verification. they also informed you by sending the email though you can also see this pin generation info with notification in your Adsense account.

How much time this does PIN take to reach us?

This depends on the distance of your place or country. Usually, it takes 2-4 weeks to get your pin at your given address. however, you can also wait up to 6 weeks as it could be more delay because of your postal service too.

When can I generate new pin and is it limited to generate the PIN?

Once your four weeks of a period is over you can generate a new PIN, you can also check this in your account where you can find the date after that you can generate a new pin. Yes, there is a limitation in the PIN generation. there are only three attempts to generate the PIN. So Make sure to change the address where you can easily receive Your PIN. And the address is easily available to the postmaster.

What if in all the attempts we could not receive the PIN?

Don’t worry! if you don’t receive it in all the attempts then you can verify your identity by uploading the Government authorized identity card.

I have verified my address PIN still it is showing the notification to verify the identity. do I need to make one more verification?

Yes, for few country or place both are required, so just upload your ID and verify it. It is very simple. Make sure your name in ID and Adsense account must be same.

In a case of any queries, you can write us at we will get back to you ASAP.

Hope! you would have enjoyed this post.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!


How To Stop Spam Email?

Hello Friends,

In this blog post, we are going to share a very interesting story in order to stop the spam emails coming to your inbox folder.

And the situation becomes worst when you don’t find any unsubscribe option in that.

Most of the users may be upset with the problem of spam emails inbox. So here in this blog post, we are going to share all possible ways to stop the spam email coming to your inbox.

The very first and easy way to stop the spam emails is to click the unsubscribe option listed in the email template or body. Generally, unsubscribe option is kept at the bottom but you can also find it in the email header.

So once you click the unsubscribe option then you will not probably receive the email from that sender.

But it not a guarantee that you will not get any further emails from the same sender in future.

Why this happens even after unsubscribing the emails you again get it in your inbox at some point in time?

This is because of your email address listed in multiple email list of sender and they do maintain to check blocked email address. So once you unsubscribe the email then it removes your email address from one list but it is still listed in another list of the sender.

So when a sender sends another email campaign to the same list where you are still listed then you again get the email from the same sender which you have been unsubscribed.

What to do if spam is coming even after unsubscribing?

A first simple thing you can do is to block the domain sending you the spam email again.

how would you do this?

In most of the email client like Gmail, Yahoo you have a facility to block the email address or domain as in the Gmail You can find it under Setting>>blockaddress.

You just need to put the full email address or domain here to block the email address however you can also block the address with the option given in the inbox panel for the specific email.

If you are using email client which does not have such facility to block the address then you can follow the below-given procedure.

Before explaining the procedure I wish you to explain the types of emails you receive.

You may receive two types of email in your inbox first email is with customized branding and verified domain the second one with ESP branding without a verified domain.

In a customized branded email with a verified domain, you can not identify that using which ESP sender is sending the email. Whereas in another case you can easily see the ESP branding in the email, for example, email via Amazon.

So if you receive an email with ESP branding where the sender domain is not verified then you can write down the ESP name can get its contact information or email from internet.

And then you can directly send an email to this ESP reporting for spam user sending you the spam emails. they will surely block or warn that user to stop sending the spam email to you.

In the first case where you don’t get the information about ESP then you can search the domain hosting site and can send an email to directly to the hosting company of that domain which is sending you the spam email.

Hosting company will take the action against the user or will warn him not to send the spam to you again. And you will not get any further spam email from this user.

In both the above cases user can’t ignore the warning either of ESP or hosting company because it can cause a shutdown to his account so sender will immediately stop sending spam to your email address.

In a case of any queries, you can write us at we will get back to you ASAP.

Hope! you would have enjoyed this post.

Please feel free to give your important feedbacks in the comment section below.

Have a great time! Sayonara!