Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Retrieve error const name by value for Upload
  • Hi guys,
    I'm working with Upload class ... If I got an error during upload ( with an error like 102 ) and I would use upload error CONST name for convenience ( for example : a message using translations ) There's a best way to retrieve the error constant name by error code??
  • And done. The get_files() and get_errors() methods now return an extra array key 'message'.
  • Assuming two constants don't share the same value, you can use the following: http://scrp.at/4D But... why?
  • Because I want to provide an error message ( using translations ) to an user, like this http://scrp.at/4E
  • I'm planning to build this into the Upload class, so you don't have to. But in the end the code is going to be the same: a foreach over the files array, and a switch/case to deal with all error codes.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion