kev_120 Posted September 16, 2007 Share Posted September 16, 2007 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! Quote Link to comment Share on other sites More sharing options...
zq29 Posted September 16, 2007 Share Posted September 16, 2007 Code? Quote Link to comment Share on other sites More sharing options...
kev_120 Posted September 18, 2007 Author Share Posted September 18, 2007 <? 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(); } ?> 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.