0

Hey guys I noticed when I switched my provider to a dedicated server (Winhost to MediaTemple) that my file uploading system no longer works because it can't read the file sent in for some reason. So I put aside a tester to figure out why and I used:

<form method="post" action="./readtest.php">
        <div>
            <span>Enter Name of First Name Column: </span><input name="firstname" class="Rfirstname-input" type="text" />
        </div>
        <div>
            <span>Enter .csv File: </span><input type="file" name="csvfile" value="" />
        </div>
        <div>
        <input type="submit" class="Rsubmit" value="Submit"/>
        </form>

than:

<?php
echo $_POST['firstname'];
var_dump($_FILES['csvfile']);
?>

Now the firstname post will print out but the dumping of the files is null (I upload .csv files). Now the weird part, when I change the $_FILES to $_POST - it actually prints out the name of the file, so it is actually going in yet not reading it? I tried for other files to.....I don't know if it is something in my .ini file for php or what but I could use the help!

David Biga

David Biga
  • 2,763
  • 8
  • 38
  • 61

2 Answers2

2

Take a look at this answer:What does enctype='multipart/form-data' mean?

You are missing the enctype on your <form>

Community
  • 1
  • 1
enapupe
  • 15,691
  • 3
  • 29
  • 45
  • Do I need to var_dump($_POST...) than? or keep it as file – David Biga Mar 30 '13 at 22:48
  • Did you refreshed the html page? You might test the result printing $_FILES: print_r($_FILES); – enapupe Mar 30 '13 at 22:52
  • Yes....that printed the results but for my main function it does not seem to be working – David Biga Mar 30 '13 at 23:41
  • Hey so I created a jsfiddle http://jsfiddle.net/DrEJB/1/ - if you could check it out, I am having that issue where I am unable to open to store the values of the inside of the .csv file and it seems to just kick me out...so check it out and let me know please – David Biga Mar 30 '13 at 23:54
1

Add enctype="multipart/form-data" to your <form>.

Michael
  • 11,912
  • 6
  • 49
  • 64