Giter VIP home page Giter VIP logo

Comments (4)

samayo avatar samayo commented on June 2, 2024

You are trying to catch an exception which isn't thrown inside your code, or inside the bulletproof class. If you have seen the inside of bulletproof.php there are no exceptions being thrown so this won't show anything.

echo $e->getMessage(); // won't work

If you want to show exceptions instead of errors, then your exception block should look something like this:

try {

   if($image['foo'] && $image->upload()){
      //...
   }else{
      throw new \Exception($image['error']);
   }

} catch (Exception $e) {
    echo $e->getMessage();    
}

Also, if you are seeing a blank page, make sure you have set errors to be displayed, or put this in your script.

error_reporting(E_ALL);
ini_set('display_errors', 1);

check these and let me know.

from bulletproof.

remedcu avatar remedcu commented on June 2, 2024

Can you please tell me a way to show error related to the size like "File uploaded is more than 5MB" when the uploaded file is more than 5 MB? As I have already set the hidden field "MAX_FILE_SIZE" value as 5000000

from bulletproof.

samayo avatar samayo commented on June 2, 2024

Okay, after some time I found the issue, this is most likely a bug with the newer version of bulletproof, as the previous version does not show this error. I have created a dev branch and added this code

https://github.com/samayo/bulletproof/blob/dev/src/bulletproof.php#L127-L129

Your code should look like this to show the error:

$image = new \Bulletproof\Image($_FILES);

if($image['pictures']){
 // upload
}else{
  var_dump($image['error']); // error will be shown here
}

make sure to download the dev branch or add those lines to your bulletproof class.

I will try to find a better way to handle this, and will leave this open until I fix the issue

from bulletproof.

remedcu avatar remedcu commented on June 2, 2024

It's working fine now. Thank you for the patch.

from bulletproof.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.