954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Uploading File Not Working...simple code, what's wrong?

Why, oh why isn't this simple thing working? I just want to understand why the variable $file1 is always empty. Other input types work just fine.

<?php

$file1 = $_POST['file1'];

echo "file1:", $file1;

?>			
			
			
<form ENCTYPE="multipart/form-data" action="add.php" method="POST">
  
  File<input type="file" name="file1"   />
  
  <input type="submit" value="Submit Information">
            </form>


Jill

Aldebaran
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 
echo $_FILES['file1']['name']; // Name
echo $_FILES['file1']['size']; // Size


... http://www.php.net/features.file-upload

- Mitko Kostov

MitkOK
Junior Poster
142 posts since Jul 2007
Reputation Points: 59
Solved Threads: 12
 

Excellent, thank you very much!
Didn't realize it was an array.
J

Aldebaran
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You