Jump to content

dynomonkey

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dynomonkey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi everyone, Ive been working on a simple system that allows files to be uploaded to my server and I'm having problems receiving the $_POST and $_FILES variables from my form. It appears the POST method isnt working for sum reason. here is my code: <form action="procnewsletter.php" method="post" enctype="multipart/form-data">   <table width="350" border="0" cellpadding="1" cellspacing="1" class="box">     <tr> <td>Title: </td> <td><input type="text" name="title"></td> </tr>      <tr>        <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000">       <input name="userfile" type="file" class="box" id="userfile">          </td>       <td width="80"><input name="upload" type="submit" class="box" id="upload" value="Upload"></td>     </tr>   </table> </form> And the proccessing page (procnewsletter.php) does the following: <? $title = $_POST['title']; echo $title; $uploadDir = 'Files/Newsletters/'; if (!is_uploaded_file($_FILES['userfile']['tmp_name'])) {   echo "You did not upload a file!";   }     $fileName = $_FILES['userfile']['name'];     $tmpName  = $_FILES['userfile']['tmp_name'];     $fileSize = $_FILES['userfile']['size'];     $fileType = $_FILES['userfile']['type'];     $filePath = $uploadDir . $fileName; if(move_uploaded_file($tmpName, $filePath)) {     echo "The file has been uploaded"; } else{     echo "There was an error uploading the file, please try again!"; }               ?> I always receive the "You did not upload a file!" error, and nothing is stored in the variables i created. This is because nothing seems to be passed in the header when using POST method. so I cant retreive any of the information entered in the form.  IF i remove method="post" from the form then i can get the title using $_REQUEST['title] but i still dont get anything in the $_FILES array. Any help would be much much much appreciated. Thank you very much.
×
×
  • 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.