File not uploaded

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tanvirtonu
Forum Commoner
Posts: 35
Joined: Wed Oct 17, 2007 9:15 am

File not uploaded

Post by tanvirtonu »

I have written a simple php code to upload a file . There is no error when I run the code but file is not uploaded in the specified directory.

Code: Select all

<?php

		
		$dir="\uploadedFile";

		foreach($_FILES as $filename => $filearray )
		{
		
		
		echo $filearray['tmp_name']."<br>";
		echo $filearray['name']."<br>";
		echo $filearray['size']."<br>";
		echo $filearray['type']."<br>";
		
		if( is_uploaded_file($filearray['tmp_name'] )  )
		{
		move_uploaded_file( $filearray['tmp_name'] ,    "$dir\$filearray[name]"  );
		
		echo " file is uploded<br>";
		
		}
		
		}
		
		
?>
my html form code is as follws-

Code: Select all

<body>
<form action="fileupform.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="fileupload">
<p> <input type="submit" value="upload" >
</p>
</body>
I hav made a directory named uploadedFile in htdocs folder. The name as specified for the destination directory.Everything goes well but the file is not there in the directory. PLs help me.
Post Reply