$_FILES not working after move to dedicated server

My site was hosted on a shared server.  I am in the midst of trying to switch to a dedicated server after performace issues.  However, code that had been working on the old server is no longer working on the new.  It is a linux box, which i don't know very much about, so i'm trying to learn.  Specifically, code that was working to upload files is no longer working.  Here is the code:

 <table width="77%" border="0" cellspacing="0" cellpadding="3" align="center">
  <form action="?page=2" method="post" enctype="multipart/form-data">
  <tr>
    <td colspan="2"><div align="center"><strong><font size="+2" face="Verdana, Arial, Helvetica, sans-serif">Upload
        CSV File</font></strong></div></td>
  </tr>
  <tr>
    <td width="22%">File</td>
    <td width="78%"><input type="hidden" name="MAX_FILE_SIZE" value="20000">
   <input type="file" name="csvfile"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value=" Submit "></td>
  </tr>
  </form>
</table>

However, after submitting the form, the $_FILES array is empty.

I think maybe it has to do with permissions on the temp directory.  The temp directory is not set in php.ini, so it is my understanding that it is using the default temp directory for the server.  
consultgalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mnb93Commented:
"The temp directory is not set in php.ini" : Have you set it? Because that is more than likely the problem
0
mnb93Commented:
According to what i’ve read on the manual, it seems to be caused by having

file_uploads = off

in the php.ini, or (as it was in my case), having no free space available.
0
mnb93Commented:
Don’t forget to always have the form tag include the enctype=”multipart/form-data”
If you don’t put this in, you won’t see anything in your _FILES var.

Uhhhgh! I’m an idiot! Aside from needing to have enctype=multipart/form-data, I found that i had made my MAXFILESIZE hidden tag set too low, PHP parses this and will spit out 2 as the value for the error element in the files hash.

0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

mnb93Commented:
http://getluky.net/2004/10/04/apachephp-_files-array-mysteriously-empty/

check  
 
1) Whether file upload is enabled in your php.ini.
 
2) Check whether the temporary upload folder is set correctly in  
php.ini file.
 
3) The html tag form sometime must have the attribute
'enctype="multipart/form-data"' set.

http://www.faqts.com/knowledge_base/view.phtml/aid/19252

Hopefully these help.
0
consultgalAuthor Commented:
1. File upload ins enabled in php.ini

2. This is what I think the problem is.  Can someone please tell me the correct way to set this?  After leaving it empty, thinking that it would just use the default for the server which should have the appropriate permissions, I currently have it set to "./tmp/".  However, since I know nothing about linux, I don't know where that driectory actually resides so that I can check for the appropriate permissions.

3. As you can see in my code snippet above, I do have that.
0
mnb93Commented:
file_uploads = On
upload_max_filesize = 2M


"I currently have it set to \"./tmp/\"."  What is the config line that you set?

Try deleting it.


" <table width="77%" border="0" cellspacing="0" cellpadding="3" align="center">
  <form action="?page=2" method="post" enctype="multipart/form-data">
  <tr>
    <td colspan="2"><div align="center"><strong><font size="+2" face="Verdana, Arial, Helvetica, sans-serif">Upload
        CSV File</font></strong></div></td>
  </tr>
  <tr>
    <td width="22%">File</td>
    <td width="78%"><input type="hidden" name="MAX_FILE_SIZE" value="20000">
   <input type="file" name="csvfile"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value=" Submit "></td>
  </tr>
  </form>
</table>"

For "?page=2" can you test it with:

<?php

print_f($_GET);
print_f($_POST);
print_f($_FILES);

?>

The global $_FILES  exists as of PHP 4.1.0 (Use $HTTP_POST_FILES  instead if using an earlier version). These arrays will contain all the uploaded file information.

Files will, by default be stored in the server's default temporary directory, unless another location has been given with the upload_tmp_dir directive in php.ini. The server's default directory can be changed by setting the environment variable TMPDIR in the environment in which PHP runs. Setting it using putenv() from within a PHP script will not work. This environment variable can also be used to make sure that other operations are working on uploaded files, as well.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mnb93Commented:
Thanks for the points, I would also like to know what fixed it?

Steven
0
consultgalAuthor Commented:
Oops, I thought I posted a response....weird.

Anyway, what I thought I said was: my dedicated server was running version 3.x of MySQL, which not only explains the above problem but another one I was having with a query using UNION.  Doh!  Now, being a Linux newbie I just need to figure out how to install a GPG key so I can upgrade.

Thanks!

Courtney
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.