bleastan Posted July 19, 2010 Share Posted July 19, 2010 Hey people i got a question where im seriously stuck with.I got a php file which reads .csv files and writes it to the database. When i run it locally it works perfectly (with a standard xampp installation). However my problem is, when i put the exact same script on the webserver it cant find the file anymore (even tthough i point to it through the form)Ik heb een php bestand die dus csv inleest en dit naar een database schrijft. Lokaal werkt dit helemaal 100% perfect (via xampp). Heres a small part of the code:the form:<?php<table ><form name="form" method="post" action=' . $_SERVER['PHP_SELF'] . '""><tr><td>Bestand: </td><td><input type="file" name="bestand"></td></tr><tr><td>knop</td><td><input type="submit" value="upload" name="eenValue"/></td></tr></table></form>';?>What it does is as soon as you submit the form it does php_self and the variable eenValue becomes upload. With this value it goes into the correct case where it does the following:<?phpcase 'upload':if (!file_exists($_POST['bestand'])) {echo "Bestand niet gevonden. \n";//this means file not found.} else {insertFile();}break;?>what happens is is that i keep getting the 'file not found' error.. which is weird (in my opinion) cause locally Everything works but as soon as its on the webserver i get this.So anyone have any suggestions? im seriously stuck here and have no clue whatsoever on how to fix it. Thanks in advance.Btw locally i run a standard xampp installation (if ppl need to know about it) Link to comment Share on other sites More sharing options...
wirehopper Posted July 19, 2010 Share Posted July 19, 2010 You can't use $_POST with a file, you need to use $_FILES. This link should help you.http://us.php.net/manual/en/features.file-upload.php Link to comment Share on other sites More sharing options...
bleastan Posted July 20, 2010 Author Share Posted July 20, 2010 You can't use $_POST with a file, you need to use $_FILES. This link should help you.http://us.php.net/manual/en/features.file-upload.php thanks alot didnt know about the $_files variable. problem solved Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.