Hi guys,
This one has got me completely stumped. Here are my trouble shooting notes.
My upload script works absolutely fine without any changes on localhost. However, on the live production server my files do not get uploaded.
My view is:
<?php echo form_open_multipart('upload/do_upload');?>
<input type="file" name="userfile" size="20" />
<br/>
<button type="submit" class="btn btn-success btn-s-xs " id="">Upload</button>
<?php echo form_close(); ?>
And my controller is...
function do_upload()
{
/**
* @Description: Make sure NOT to autoload this lib!!!
*
*/
$config['upload_path'] = "./uploads";
$config['allowed_types'] = '*';
$this->load->library('upload', $config);
/**
* @Description: unsuccessful
* @params : params
* @returns : return
*/
if ( ! $this->upload->do_upload())
{
echo $this->upload->display_errors('<p>', '</p>');
}
/**
* @Description: successful
* @params : params
* @returns : return
*/
else
{
$data = array('upload_data' => $this->upload->data());
}
}
As you can see it is super simple. I've also set my 'uploads' folder to have 777 permissions. I don't have any htaccess files. In my config file I have $config['index_page'] = 'index.php';
So there can be no way any .htaccess files are causing a problem. Also there are NO htaccess files within the 'uploads' folder.
In my controller I've allowed for all filetypes to be uploaded and no restrictions on size. For testing on my live server I have tried to upload a tiny jpg, and a tiny text file. Again it doesn't work. But it DOES work on my localhost!!
The other strange thing is the file upload error message says 'You did not select a file to upload'
Which is stupid because I am, and it works fine in localhost.
The PHP versions are the same on localhost and on my production server. I have not changed the directory structure in localhost and my production server. All files are identical except for the baseurl which I've obviously changed to my domain address.
Localhost I'm using a linux server, my production server is centos, so effectively there should be no issues with file case sensitivity.
As I said before the uploads folder is writtable, and the only thing I have to work with is that confusing error message!
Any help would be most grateful. Thanks in advance!!!