Jump to content

Archived

This topic is now archived and is closed to further replies.

tomjung09

[SOLVED] $_FILES['<path>']['<name>'] not coming up with anything

Recommended Posts

It seems like nothing is going right for me here lol.  I am trying to upload a file from the clients computer to the server.  I have been testing my code for about 2 hours and I cannot figure out why this does not work:

 

original file:

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

 

Upload file:

	
$test = $_POST['txtimage1'];
echo "test " . $test . " \n";

if ($_FILES["txtimage1"]["error"] > 0)
  {
  echo "Error: " . $_FILES["txtimage1"]["error"] . "<br />";
  }
else
  {
  echo "Upload: " . $_FILES["txtimage1"]["name"] . "<br />";
  echo "Type: " . $_FILES["txtimage1"]["type"] . "<br />";
  echo "Size: " . ($_FILES["txtimage1"]["size"] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES["txtimage1"]["tmp_name"];
  }

 

test prints out the path that was inputed to txtimage1, but everything else outputs nothing.  Could this be a server side issue or am I missing something?

 

Share this post


Link to post
Share on other sites

I am using the form:

<form id="form1" name="form1" method="post" action="uploadbikesubmit.php">

to submit

Share this post


Link to post
Share on other sites

Wow this was a headache.  I figured it out, you have to have:

<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="uploadbikesubmit.php">

 

enctype="multipart/form-data" in the form settings.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.