Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Problem passing $_FILES variables

Avatar of andyw27
andyw27 asked on
PHP
5 Comments1 Solution446 ViewsLast Modified:
Hello,

All of a sudden my upload page has stopped working.  I tried to find anything that might be broken and have found this:

Here is the upload form code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="form1.php" method="post" enctype="multipart/form-data" name="material_upload" id="material_upload_id">
<table width="450" border="0" cellpadding="2" cellspacing="2">
    <tr>
      <td width="210" class="tableHeaderText">&nbsp;</td>
      <td width="195">&nbsp;</td>
      <td width="34"><input name="hidden_upload_material" type="hidden" id="hidden_upload_material" value="upload_material" /></td>
    </tr>
    <tr>
      <td><input type="hidden" name="MAX_FILE_SIZE" value="3000000"></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="tableHeaderText">Image:</td>
      <td><input name="uploaded_image" type="file" id="uploaded_image"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><div align="right">
        <input type="submit" name="cmd_upload" id="cmd_upload" value="Add Details" />
      </div></td>
      </tr>
  </table>
</form>
</body>
</html>


As you can see if points to form1.php

Here is the code for that:

(see code window)


-----------
I would expect of 4 $_FILES to be populated here however all it gathers is the filename and a value of 0 for the size.  Both tmp_name and type are blank.

Does anybody have idea what could of happened here?

Thanks.
<?php
 
// Get MySQL connection
include "./includes/SimpleImage.php";
 
 
 
///////////////////////////////////////////////////////////
 
// Upload image to server
 
$fileName = $_FILES['uploaded_image']['name'];
$tmpName  = $_FILES['uploaded_image']['tmp_name'];
$fileSize = $_FILES['uploaded_image']['size'];
$fileType = $_FILES['uploaded_image']['type'];
 
?>
<table width="50%" border="1" align="center">
  <tr>
    <td width="54%">File Name</td>
    <td width="46%"><?php echo $fileName; ?></td>
  </tr>
  <tr>
    <td>Tmp Name</td>
    <td><?php echo $tmpName; ?></td>
  </tr>
  <tr>
    <td>File Size</td>
    <td><?php echo $fileSize; ?></td>
  </tr>
  <tr>
    <td>File Type</td>
    <td><?php echo $fileType; ?></td>
  </tr>
</table>
ASKER CERTIFIED SOLUTION
Avatar of andyw27
andyw27

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers