Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The process for uploading both PDF and image files in a single form using Codeigniter can be achieved through the following steps:

  1. Add the necessary form elements to the view file, including file input fields for both PDF and image files.

  2. Create a controller function to handle the form submission and file upload process. Use the file upload library of Codeigniter to handle the file uploads.

  3. In the controller function, validate the file type and size before uploading. For example, restrict the file types to only PDF and image files and set a maximum file size limit.

  4. Rename the uploaded files to ensure their uniqueness and to prevent overwriting of files with the same name.

  5. Save the file names to the database or any other persistence medium.

  6. If the file upload was successful, redirect the user to a success page. Otherwise, display an error message to the user.

The Codeigniter documentation provides detailed instructions on how to use its file upload library and handle file uploads in general.