HomeSunday, June 24, 2018, 01:44:03

Upload Image With PHP

Monday, February 9, 15, 01:12:13, 3 Yaers Ago Via wain, Hits: 6710
[Example3] Tutorial - How to upload image in php.

$extension = substr(strrchr($current_image, '.'), 1);
if (($extension!= "jpg") && ($extension != "jpeg"))
die('Unknown extension');
$time = date("fYhis");
$new_image = $time . "." . $extension;
$action = copy($_FILES['image']['tmp_name'], $destination);
if (!$action)
die('File copy failed');
echo "File copy successful";
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name="image" ><br>
<input type="submit" name="Submit" value="submit">
?> Friday, June 4, 2010, 13:06:14

simple and but like it should be! great article m8. ;)

fada Saturday, June 26, 2010, 09:06:17

good work done here keep it up

Prabhu Sunday, September 12, 2010, 10:29:13

Ya ..
It is Very nice and Simple
Thank U very much

NIL KHAIR Friday, October 15, 2010, 06:57:25

Thnks sir for giving me this code thnk u so muchhhhhhhh

Sreejith.K.S Monday, November 8, 2010, 02:02:29

Nice n Simple,Thnx..

john Monday, November 22, 2010, 21:59:46

Can you pls post what is needed to limit image size?

btw very simple great!

Thanks in advance

Gochu Tuesday, December 14, 2010, 07:17:11

Thanks a lot.. Is easy for beginners also..

Vivek Tuesday, December 14, 2010, 07:20:10

Thanks a lot.. Very simple and appropriate..

custom php mysql programming Thursday, December 23, 2010, 06:01:27

I got very clear idea for my image upload...
keep on update new post...
Thank you!!

Hammad Wednesday, February 16, 2011, 12:14:37

Thanx its very helpful and easy

Sudhir Sharma Friday, March 11, 2011, 06:44:36

This is Nice idea but i think it may be more easy to fetch image from data base after upload image if we concatenate the userid with image name instead time of uploading image which making it unique in uploads folder.

kiki Friday, March 25, 2011, 10:40:27

nice piece of code

Hanif Sunday, March 27, 2011, 17:09:35

Great dear.... its so easy to implement... thanks a lot.

ROCKESH RONITH Thursday, April 7, 2011, 03:55:01

Thanks...its too good and easy to understand..easy to implement.....
tahnxxx a lot....

Raghu Friday, April 8, 2011, 04:31:56

its very nice
Thank U

viktorija Saturday, April 30, 2011, 18:24:29

Very useful tutorial, thank you

jolanda Friday, May 20, 2011, 07:14:22

Very nice tutorial. Thx.

benkbauer Thursday, June 2, 2011, 11:18:19

i can\'t browser the image..
can someone help me?

prakash Tuesday, October 18, 2011, 13:10:52

very nice thanQ

Sus Wednesday, November 2, 2011, 10:29:58

it is simple

jagesh maharjan Saturday, November 5, 2011, 06:50:45

now after upload, how do i display that image in the web page.

roshan Sunday, November 6, 2011, 04:14:02

i want to know where the image was uploaded.

Robert Monday, November 21, 2011, 05:28:56

Thank you very much... simple + easy plug-in

Robert Monday, November 21, 2011, 05:30:23

echo \"Thank you very much...
It is simple and understandable...\";

Minhaj Wednesday, January 18, 2012, 02:22:57


Hims Thursday, January 19, 2012, 06:52:52

nice tutorial!!thnx

bistro Sunday, February 12, 2012, 12:01:46

This is great, thanks you for the code.

newly Friday, February 17, 2012, 14:44:55


Goku Monday, February 27, 2012, 06:02:33

This is really useful! ..Thanks for sharing.

MANU Friday, March 30, 2012, 09:26:20

Very nice !!

ajay Saturday, March 31, 2012, 07:21:57

very very thankzzz

nathan Wednesday, April 4, 2012, 13:06:11

How to Store in database please tell me

micky Wednesday, April 4, 2012, 19:54:01

echo \"File copy successful\";
$result = mysql_query(\"INSERT INTO mydatabase (image)
VALUES (\'$new_image\')\") or

Minakshi Thursday, April 12, 2012, 10:38:10 works

minakshi Thursday, April 12, 2012, 10:45:45

thanks ,
but how to retrive from database

wain Thursday, December 8, 2016, 05:43:42

Read also How to check if uploaded file is image in php

Sign In



Session_start creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

Captcha V1 - Free PHP Script

An anti-spam form protection image written in PHP, Version: 1.1.

Show / Hide Div with CSS

CSS Display and Visibility:The visibility property specifies whether or not an element is visible.

Password Protect With PHP

Password protect tith PHP - tutorial

PHP Jquery Form

PHP Jquery Form allow your visitors to contact you directly from your website.

Site Recommendation

This script will allow your visitors to recommend your site to their friends.

Sitemap Website Sitemap

Send This Link PHP Script

A popup form which allows your visitors to send a referral link from your site. It features admin notification and HTML output.

Bookmark Current Page - PHP Tutorial

Bookmark current page with PHP example.

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials
About Author


Date Registered: Sun, Feb 8, 15
Last Time Online: Sun, Mar 18, 18
So far has created 115 entries.
This author has not yet filled in any details.