tags:

views:

77

answers:

4

I am trying to upload file using php. I am using the function move_uploaded_file. However it work okay in my local machine but when I test it in the server , it is not working. How can I know what is missing in my server.

Thanks IN advance.

A: 

Check the output of php_info() to see if the server allows file uploading - the 'file_uploads' property. If not, it must be configured to allow it.

ghills
+1  A: 

whenever you face problems in PHP, I suggest checking out log files of the web server. in this situation, I think it could be PHP configurations. check your PHP configurations and make sure that file uploads are allowed on the web server. PHP configurations are stored in a php.ini file. to find out more information, create a simple php file, say info.php and enter these lines in it:

<?php
    phpinfo();
?>

upload info.php to your server and open the page in your web browser. try to find "file_uploads". it should be "on". if it is off, find your php.ini file and change the value of "file_uploads" to "on".

farzad
+3  A: 
  1. file_uploads must be On.
  2. You must not exceed the upload_max_filesize size of the file uploaded.
  3. You must not exceed the post_max_size of the data you're submitting.
  4. You must not exceed the max_input_time as well.
  5. Make sure the user used by apache has permission to write files in the target directory.

Check if those variables in php.ini are in sync with your local server or, if you don't have access to the target server's settings, make your local ones the same and work on that.

macbirdie
A: 

I had a problem with upload where it would upload the files but it gave the files no permissions so if you tried to open them from a browser it would appear as they are not there. You might want to check to see if this is what happening.

Josh Curren