File not uploading PHP

I've attempted to write code to have a file uploaded to a "media" folder in PHP. For some reason it continues to not work.

Here's the execution code:

move_uploaded_file($_FILES["file"]["tmp_name"],"../media/" . $_FILES["file"]["name"]) or die ("Failure to upload content");

Here's my form code:

    <input type="file" name="file" id="file" /> 

Any ideas why it may not be working?


EDIT:

When I use the command "print_r($_FILES);", it displays:

Array ( [file] => Array ( [name] => Screen Shot 2012-05-29 at 12.36.11 PM.png [type] => image/png [tmp_name] => /Applications/MAMP/tmp/php/phpHNj3nW [error] => 0 [size] => 71640 ) )

Image is NOT uploaded into the folder.


Solution 1:

Make sure that in your form.. you put the enctype.
eg: <form method="post" enctype="multipart/form-data" action="index.php"></form>;

To check if files are successfully updated upon submitting the form. use print_r to see results.
print_r($_FILES);

Solution 2:

make sure media folder has 777 permission and the path ../media/ is correct

Solution 3:

Put the encription in form

<form method="post" action="index.php" enctype="multipart/form-data"></form>

Check in php.ini file max_execution_time heavy images are not uploaded due to execution time..