Jump to content

$_FILES Does Not Work on Windows


kev_120

Recommended Posts

Hey there, I'm having a PHP problem. Whenever I use the $_FILES superglobal to upload files via a form, it never seems to work when I run it on any Windows system. However, when I run it on my Mac, the image uploads just fine with the same script. What could the problem be? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/69568-_files-does-not-work-on-windows/
Share on other sites

<?

include 'http://www.faithum.org/header.php';

 

if (isset($_POST['submit']))

{

echo '<span style="float:left;">';

 

$path = getcwd();

define("IMAGEREPOSITORY",$path, true);

 

  if (is_uploaded_file($_FILES['image']['tmp_name']))

  {

  $imageresult = move_uploaded_file($_FILES['image']['tmp_name'],

  IMAGEREPOSITORY.$_FILES['image']['name']);

  }

  if ($imageresult)

  {

  echo "Image posted successfully!<br>";

  }

  else

  {

  echo "<font color=red>Image posting error!</font><br>";

  }

 

  include 'news.connect.php';

 

  $name = $_POST['name'];

  $article = $_POST['article'];

  $image = IMAGEREPOSITORY.$_FILES['image']['name'];

 

  $query = "INSERT INTO articles SET ID=LAST_INSERT_ID(), header='$name', article='$article',

  summary='$article', image='$image', timestamp=CURRENT_TIMESTAMP";

 

  $result = mysql_query($query);

 

  if ($result)

  {

      echo "Article posted successfully!";

 

  }

  else

  {

    echo "<font color=red>Article posting error!</font>";

  }

 

  echo '</span>';

 

  mysql_close();

}

?>

Archived

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

×
×
  • 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.