0

i am trying to upload image and i get this error this is the error i get i dont have any idea what to do

  1. i try to change 'src' but the picture cant upload.
  2. i try to change file_put_contents but this is doesn't work.

    static function updateUserImage() {

        global $root;
        $file = reset($_FILES);
        $fileType = strtolower($file['type']);
        $allowedExt = ajaxParams('allowedExt');
        if (key_exists($fileType, $allowedExt) && file_exists($file['tmp_name'])) {
    
            $fileData = @file_get_contents($file['tmp_name']);
            $height = intval(trim(str_ireplace('px', '', ajaxParams('picHeight'))));
            $width = intval(trim(str_ireplace('px', '', ajaxParams('picWidth'))));
            $md5 = md5($fileData);
            $fileName = 'cache/cstFiles/' . $md5 . '.' . $allowedExt[$fileType];       
            file_put_contents($root.$fileName,$fileData);
    
            if ($height > 0 && $width > 0) {
                $params[crpFileType] = $allowedExt[$fileType];
                $params[crpDestinationDir] = $root . 'cache/cstFiles/';
                $params[crpOverwriteOrig] = true;
                $params[crpResizeMethod] = 'resize';
                $resizedPic = copyResizedPic2($root . $fileName, $width, $height, $params);
            }
    
        $key = time() . rand();
        $_SESSION[__mypAjaxSessionKey__]['mypc_file'][$key] = $fileName;
        return '
            <img src="' . $fileName . '"/>
            <input hidden type="text" name="' . ajaxParams('inputName') . '" value="' . $key . '"/>';
    }  }
    
Liran Atli
  • 43
  • 1
  • 9

0 Answers0