0

I am looking for away to allow a form to submitted with an empty file upload, as codeigniter seems to always require the file upload.

Can anyone tell me how to allow the file upload to be empty?

1
  • Hi :) I found similar question with accepted answer here Commented May 26, 2011 at 21:02

1 Answer 1

3

You can manually test the $_FILES superglobal for the error code 4 (no file). If the error code is not equal to 4, then upload the image. If it's equal to 4, just skip the uploading altogether.

if($_FILES['userfile']['error'] != 4){
  // Do upload here
} 

// userfile was empty...carry on as normal.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.