Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Form finishes submitting, but file doesn't reach destination (http://www.go4expert.com/forums/form-finishes-submitting-file-doesnt-t20564/)

Dryan 31Dec2009 13:43

Form finishes submitting, but file doesn't reach destination
 
I have a php form that I use to send a file to my ftp server. It's supposed to put the file into a folder named uploads. It finishes submitting, but when I check my ftp server, the file isn't there.

Here's the php:
PHP Code:

<?php
if (($_FILES["file"]["size"] < 4000000))
  {
  if (
$_FILES["file"]["error"] > 0)
    {
    echo 
"Return Code: " $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo 
"Upload: " $_FILES["file"]["name"] . "<br />";
    echo 
"Type: " $_FILES["file"]["type"] . "<br />";
    echo 
"Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo 
"Temp file: " $_FILES["file"]["tmp_name"] . "<br />";

    if (
file_exists("upload/" $_FILES["file"]["name"]))
      {
      echo 
$_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      
move_uploaded_file($_FILES["file"]["tmp_name"],
      
"upload/" $_FILES["file"]["name"]);
      echo 
"Stored in: " "upload/" $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo 
"Invalid file";
  }
?>

When it finishes submitting, it sends me to a page that correctly says this:

Upload: !CID_chinese21.jpg
Type: image/jpeg
Size: 25.337890625 Kb
Temp file: /tmp/phpDoM7tw
Stored in: upload/image.jpg

Dryan 1Jan2010 00:56

Re: Form finishes submitting, but file doesn't reach destination
 
This has been fixed by uploading the form and .php to the root directory.


All times are GMT +5.5. The time now is 05:32.