# PHP uploading pictures problem

**URL:** https://forum.kirupa.com/t/php-uploading-pictures-problem/108835
**Category:** Uncategorized
**Created:** [April 29, 2004, 2:17am UTC](https://forum.kirupa.com/t/php-uploading-pictures-problem/108835 "2004-04-29T02:17:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Chen](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Michael\_Chen](https://forum.kirupa.com/u/Michael_Chen)
#### Post date: [April 29, 2004, 2:17am UTC](https://forum.kirupa.com/t/php-uploading-pictures-problem/108835/1 "2004-04-29T02:17:14Z")

</div>

Hi everyone

I’m currently learning php and I’m finding it quite difficult :ne:

I’m trying to upload some pictures to the server using php however I keep getting this error:

“Notice: Undefined variable: img1\_name in c:\program files\apache esting\upload.php on line 5  
No input file”

Note: I’m testing this on my local machine, I’ve also tested it on the server. And the server does support php.

Here is the html code: (some of these code were from a tutorial)

```auto

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Upload example</title>
</head>
<body>

<form method="post" action="upload.php" enctype="multipart/form-data">
<p>File <input type="file" name="img1" size="30"> <input type="submit" name="submit" value="Send"></p>
</form>

</body>
</html>

```

Here is the php code:

```php

<?php 

/* upload.php */

if($img1_name != "") {
	if($img1_size > 20000) {
		echo "File size is bigger than 20KB";
		exit;
	} else {
		@copy("$img1","/pictures/$img1_name") or die("No copy!");
	}
} else {
	die("No input file");
}

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Uploaded</title>
</head>
<body>
<p>File name <?php echo "$img1_name"; ?>,</p>
<p>File size <?php echo "$img1_size"; ?>,</p>
<p>File type <?php echo "$img1_type"; ?>.</p>
</body>
</html>

```

Any help would be great 🙂
