# Php Upload Script

**URL:** <https://forum.kirupa.com/t/php-upload-script/114023>\
**Category:** Uncategorized\
**Created:** [June 23, 2004, 10:17pm UTC](https://forum.kirupa.com/t/php-upload-script/114023 "2004-06-23T22:17:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![b\_rich](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@b\_rich](https://forum.kirupa.com/u/b_rich)\
**Post date:** [June 23, 2004, 10:17pm UTC](https://forum.kirupa.com/t/php-upload-script/114023/1 "2004-06-23T22:17:13Z")

</div>

Hi,

I have a simple upload script that seems to work, but it uploads the file as 0mb. Below is the script that the form post too. Anyone see anything wrong with it? I can’t figure it out, please help.

```php
<?php
$file_dir = "/u/htdocs/path/";

foreach($_FILES as $file_name => $file_array) {
	print "path: ".$file_array['tmp_name']."<br>
";
	print "name: ".$file_array['name']."<br>
";
	print "type: ".$file_array['type']."<br>
";
	print "size: ".$file_array['size']."<br>
";

	if (is_uploaded_file($file_array['tmp_name'])) {
	   move_uploaded_file($file_array['tmp_name'],
	      "$file_dir/$file_array[name]") or die ("Error, it seems there was a problem");
	   print "file was moved!<br><br>";
   }
}
?>

```

Thanks.
