Question

I'm using codeigniter and In my localhost, i've been using PHP version 5.3.1. My file uploading is doing great and no error whatsoever, when i uploaded it in the server, the PHP version in the server is 5.3.18. in the Server when I upload documents, i have no error but it doesn't upload to my designated folder, i've already set the folder to 777 status. any suggestions what i can do for my file uploading? thank you

EDIT

$config['upload_path'] = './upload_documents/';
            $config['allowed_types'] = 'docx|xls|xlsx|pdf';
            $config['max_size'] = '0'; // 0 = no file size limit
            $config['max_width']  = '0';
            $config['max_height']  = '0';
            $config['overwrite'] = TRUE;
            $this->load->library('upload', $config);
            $this->upload->initialize($config);
            $this->upload->do_upload('userfile');
            $upload_result = $this->upload->data('userfile');

this my upload file format, the same with my localhost, it runs effectively in the localhost but in the server it only accepts .xlsx formats

Was it helpful?

Solution 2

Yes, it is now considered deprecated in latest version of PHP. Here is a replacement hack:

function _mime_content_type($filename) {

$result = new finfo();

if (is_resource($result) === true)
{
    return $result->file($filename, FILEINFO_MIME_TYPE);

return false;
}

OTHER TIPS

Please check (debug) the folder path.

This is the general error that occurs when we upload the code to server.

Sometimes, it happens that our code resides in a different directory than document root.

That might create problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top