image preview before upload using php

image preview before upload using php

image preview before upload using PHP

When the user selects a picture, an onChange event is triggered on the file input field and that we can use JavaScript’s readURL() class to onchange event to display the image for preview. When the user choose the file, the input form is going to be submitted to an equivalent page. So on its same form.

Just modified your own code after copy below code

<style type="text/css">
		.thumb
        {
        	margin: 10px 5px 0 0;
        	width: 100px;
        }
        #blah
        {
            width: 120px;
        }
	</style>

</head>
<script type="text/javascript">
        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#blah').attr('src', e.target.result);
                }

                reader.readAsDataURL(input.files[0]);
            }
        }
    </script>

<body>
  <form id="form1" action="server.php" enctype="multipart/form-data">
        <input type='file' name="file" onchange="readURL(this);" />
        <img id="blah" src="#" alt="your image" />
        <input type="submit" name="sub" value="submit">
    </form>
</body>

 

How to convert an HTML website to WordPress

How to convert an HTML website to WordPress

How to convert an HTML website to WordPress

Step 1:
Preparing for HTML to WordPress Conversion The first and foremost thing is to choose the right hosting plan that best fits your requirements. Once you’ve purchased a plan, you will need to install WordPress and log into WordPress’s admin panel.

Step 2:
Before you start the site conversion, you must create a backup of your existing website data. It will empower you to eliminate all the migration risks. You can use a hard disk, flash drive or any other medium or object for data backup.

Step 3:
When you have a backup of your website, it’s time to create a WordPress theme. There are two options available:

Manually create a WordPress theme according to your static HTML website.
If your motive is to not only move the content from your HTML website into WordPress but also want the existing design, you will need to create a custom theme. Thankfully, this is not as difficult as it sounds at first. It involves the simple process of setting up some folders and files, copying & pasting, and then uploading the content. Here, you will need a code editor i.e. Notepad++ or Sublime. Moreover, you will require an HTML site’s directory and new WordPress install’s directory.

Create a New Theme Folder and Necessary Files On a desktop, simply create a new folder to store your theme files. Now, create the below-mentioned files in a code editor. You will not need to do, just leave them open for further coding.
Style.css
Index.php
header.php
sidebar.php
footer.php
Copy current CSS into New Stylesheet If you are looking forward to imitating a design, you will need to play with the CSS. So the first file you should edit is your Style.css file.

You should add the following code to the top of your file:

/*
Theme Name: Replace with your Theme’s name.
Theme URI: Your Theme’s URI
Description: A brief description.
Version: 1.0
Author: You
Author URI: Your website address.
*/
After this section, just paste your current CSS below and save the file.

Separate your existing HTML
Before we go further, let’s see how WordPress works. WordPress uses PHP to call and recover the data from its underlying database. Each file that is mentioned in this tutorial is created to tell WordPress which part of your web content needs to be shown and where. So, here what you need to do is just copy and paste your existing code into the individual files, you’ve just created and let WordPress know where to display them. Follow all the below mentioned steps to perform this:

First, open the index.html of your existing website. Highlight the section from the top to the div class=”main” tag. Now, copy & paste this section into your header.php file and save.
Again, open your index.html file and highlight the class=”sidebar” element and everything inside it. Now, copy and paste the copied part into your sidebar.php file and save.
Now, select everything that comes after the sidebar and copy & paste this part into your footer.php file and save.
In the end, copy everything that’s left in your index.html file and paste it into your index.php file and save.
• Finalize Your Index.php File

In order to settle your new index.php file, you need to make sure that it calls up all the other sections that is kept in other files you’ve created.

Place the following line of php. at the top of your index.php file:

Place following code to the very bottom of your index.php file

And last but not the least, you will need to add the primary bit of php that WordPress uses to showcase your content to the visitors.

Now, the final step is to add the below-mentioned code in the index.php.

<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="post-header">
       <div class="date"><?php the_time( 'M j y' ); ?></div>
       <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
        <?php the_title(); ?></a></h2>
       <div class="author"><?php the_author(); ?></div>
    </div><!--end post header-->
    <div class="entry clear">
       <?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?>
       <?php the_content(); ?>
       <?php edit_post_link(); ?>
       <?php wp_link_pages(); ?> </div>
    <!--end entry-->
    <div class="post-footer">
       <div class="comments"><?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?></div>
    </div><!--end post footer-->
    </div><!--end post-->
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
    <div class="navigation index">
       <div class="alignleft"><?php next_posts_link( 'Older Entries' ); ?></div>
       <div class="alignright"><?php previous_posts_link( 'Newer Entries' ); ?></div>
    </div><!--end navigation-->
<?php else : ?>
<?php endif; ?>

 

How to remove .php, .html, .htm extensions with .htaccess

How to remove .php, .html, .htm extensions with .htaccess

What is an .htaccess file
An .htaccess file may be a simple ASCII file that you simply create with a text editor like Notepad or TextEdit. The file lets the server know what configuration changes to form on a per-directory basis.

Please note that .htaccess is that the full name of the file. It isn’t file.htaccess, it’s simply .htaccess.

.htaccess files affect the directory during which they’re placed in and every one children (sub-directories). for instance if there’s one .htaccess file located in your root directory of yoursite.com, it might affect yoursite.com/content/, yoursite.com/content/images/, then on…

It is important to recollect that this will be bypassed. If you don’t want certain .htaccess commands to affect a selected directory, place a replacement .htaccess file within the directory you don’t want to be affected with the changes, and take away the precise command(s) from the new file.

Features
With an .htaccess file you can:

Redirect the user to different page
Password protect a selected directory
Block users by IP
Preventing hot-linking of your images
Rewrite URLs
Specify your own Error Documents
In this tutorial we’ll be focusing only on rewriting URLs.

Removing Extensions
To remove the .php extension from a PHP file for instance yoursite.com/wallpaper.php to yoursite.com/wallpaper you’ve got to feature the subsequent code inside the .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

If you would like to get rid of the .html extension from an HTML file for instance yoursite.com/wallpaper.html to yoursite.com/wallpaper you merely need to change the last line from the code above, to match the filename:

RewriteRule ^([^\.]+)$ $1.html [NC,L]

That’s it! you’ll now link pages inside the HTML document without having to feature the extension of the page. For example:

wallpaper
Adding a trailing slash at the top
I received many requests asking the way to add a trailing slash at the top, for example, yoursite.com/page/

Ignore the primary snippet and insert the code below. the primary four lines affect the removal of the extension and therefore the following, with the addition of the trailing slash and redirecting.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Link to the HTML or PHP file an equivalent way as shown above. Don’t forget to vary the code if you would like it applied to an HTML file rather than PHP.

For Example

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^location/([0-9a-zA-Z_]+) job-by-city.php?city=$1
RewriteRule ^category/([0-9a-zA-Z_]+) job-by-category.php?category=$1

RewriteRule ^openings/([0-9a-zA-Z_]+)/([0-9a-zA-Z_]+) jobs-link.php?city=$1&category=$2

RewriteRule ^details/([0-9]+) job-details.php?jdid=$1

ErrorDocument 404 /404.php

RewriteRule ^jobs-in-delhi?$ jobs-in-delhi.php

Some people asked how you’ll remove the extension from both HTML and PHP files. I don’t have an answer for that. But, you’ll just change the extension of your HTML file from .html or .htm to .php and add the code for removing the .php extension.

How to Increase the Maximum File Upload Size in WordPress

How to Check Your Maximum File Upload Size Limit in WordPress?

WordPress will automatically show the utmost file upload size limit once you are uploading images or media. to see it you’ll simply attend Media » Add New page and you’ll see the utmost file uplaod size limit for your WordPress site.

1: Theme Functions File

There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:

@ini_set( 'upload_max_size' , '32M' );
@ini_set( 'post_max_size', '32M');
@ini_set( 'max_execution_time', '300' );

htaccess Method

Some people have tried using the .htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Edit the .htaccess file in your WordPress site’s root folder and add the following code:

1
2
3
4
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
how to remove .php extension from url in php

how to remove .php extension from url in php

remove .php extension from url in php

Just follow these steps

Open .htacess file and copy below code in .htacess file

 
RewriteEngine On

RewriteRule ^test?$ test.php

Here test is your page name
Now you can visit your page like abc.com/test

remove ?id from url in php

if your url is user.php?id=1
then just copy the below code in your htacess file
RewriteEngine On

RewriteRule ^user/([0-9]+) user.php?id=$1



RewriteRule ^test?$ test.php

RewriteRule ^user/([0-9]+) user.php?id=$1


RewriteRule ^shop/cat/([0-9a-zA-Z]+)/subcat/([0-9a-zA-Z]+) shop.php?cat=$1&subcat=$2




  That’s It. Now you see a magic in your url    
Secured By miniOrange