tomjung09 Posted April 28, 2009 Share Posted April 28, 2009 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? Quote Link to comment Share on other sites More sharing options...
tomjung09 Posted April 28, 2009 Author Share Posted April 28, 2009 I am using the form: <form id="form1" name="form1" method="post" action="uploadbikesubmit.php"> to submit Quote Link to comment Share on other sites More sharing options...
tomjung09 Posted April 28, 2009 Author Share Posted April 28, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.