getimagesize () does not work in Plesk + Windows

0

I have the following code:

$info = getimagesize($this->tmp_name);

When I parse the $ info variable, I checked that it was empty.

  • I checked that the GD library was installed.
  • I checked the write permissions on folders.
  • I checked the variable $this->tmp_name , its value was C: \ Windows \ Temp \ php85CD.tmp
  • I noticed the open_basedir directive was different: * D: \ Inetpub \ vhosts \ myite.com \ httpdocs * (should not be C: \ Windows \ Temp \ ?)

If not, what might be the problem, since the upload does not work?

    
asked by anonymous 17.11.2014 / 17:42

1 answer

2

Let's break it down:

  • getimagesize () expects the first argument to be an image file. Informing the temporary file can be the cause of the problem;

    1.1. And that does not mean that the role is who is preventing the upload. To verify upload error you should check the error index value in $ _ FILES :

    if( $_FILES['upload']['error'] == UPLOAD_ERR_OK ) {
    
        // Sucesso! Trabalhe com move_uploaded_file()
    
    } else {
    
        // Uh-oh :(
    }
    
  • $ info being "white" probably means that you have echoed a FALSE value returned by getimagesize () when it crashes.

    2.1. If it failed and returned FALSE and you did not see any errors, your alerts are disabled or too low to display Warning:

    error_rerpoting( E_ALL );
    ini_set( 'display_errors', TRUE );
    
  • open_basedir is different from upload_tmp_dir .

    The received value is correct because it restricts file manipulation functions to operate on files outside directory root .

  • 17.11.2014 / 18:39