Welcome Guest, Not a member yet? Register   Sign In
File Upload - success but 0 bytes

I am uploading a text file and there doesn't appear to be any error message but afterwards, the uploaded file is empty - 0 bytes. Here is the code I'm using. Any ideas. I've got other features that upload files successfully and I've cloned that here.
$data['resultmsg'] = "";
$config['upload_path'] = 'application/import/';
$config['allowed_types'] = 'txt';
$config['overwrite'] = true;
$this->load->library('upload', $config);
$data['upload_data'] = '';
if (!$this->upload->do_upload('userfile')) {
  $data['resultmsg'] = $this->upload->display_errors();
} else {
  $data['resultmsg'] = "Upload success!";
  $data['upload_data'] = $this->upload->data();

By default the upload routine expects the file to come from a form field called userfile, and the form must be of type “multipart”.

Theme © iAndrew 2016 - Forum software by © MyBB