Welcome Guest, Not a member yet? Register   Sign In
Getting an error message whenever selecting a file
#1

(This post was last modified: 05-29-2023, 04:46 AM by KilbertVangriala.)

In my project using CodeIgniter, I want to read file contents and need to validate if a file has been selected. Here's the code in my controller:

$this->form_validation->set_rules(
  'estimation_file',
  'Project Estimation File',
  'required'
);
However, when I try to select a koowspin file, I receive an error message stating that "The Project Estimation File field is required".
Reply
#2

One possible cause of this error message could be that the file input field is not being properly named or submitted with the form data. In order for the server to receive the file contents, the input field must have a name attribute set to a unique value that can be used to identify it when the form is submitted.

Additionally, it's important to make sure that the form element has the 'enctype' attribute set to 'multipart/form-data', which is required for forms that contain file inputs.

Another possible issue could be related to the configuration of your CodeIgniter installation. If file uploads are not enabled or are restricted in some way, it could prevent the server from receiving the file contents and cause the validation error to occur.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB