ユーザーのプロフィール写真を変更する ajax アップロードに Fineuploader を使用しています。upload.php ファイルの一部を以下に示します。
function handleUpload($uploadDirectory, $replaceOldFile = FALSE){
    if (!is_writable($uploadDirectory)){
        return array('error' => "Server error. Upload directory isn't writable.");
    }
    if (!$this->file){
        return array('error' => 'No files were uploaded.');
    }
    $size = $this->file->getSize();
    if ($size == 0) {
        return array('error' => 'File is empty');
    }
    if ($size > $this->sizeLimit) {
        return array('error' => 'File is too large');
    }
    $pathinfo = pathinfo($this->file->getName());
    $filename = $pathinfo['filename'];
    //$filename = md5(uniqid());
    $ext = @$pathinfo['extension'];     // hide notices if extension is empty
    if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
        $these = implode(', ', $this->allowedExtensions);
        return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
    }
    $ext = ($ext == '') ? $ext : '.' . $ext;
    if(!$replaceOldFile){
        /// don't overwrite previous files that were uploaded
        while (file_exists($uploadDirectory . DIRECTORY_SEPARATOR . $filename . $ext)) {
            $filename .= rand(10, 99);
        }
    }
    $this->uploadName = $filename . $ext;
    if ($this->file->save($uploadDirectory . DIRECTORY_SEPARATOR . $filename . $ext)){
        return array('success'=>true);
    } else {
        return array('error'=> 'Could not save uploaded file.' .
            'The upload was cancelled, or server error encountered');
    }
}    
したがって、画像が同じ名前でアップロードされた場合、番号付きの複製が作成されるため、asd.jpg が asd44.jpg の 2 倍アップロードされた場合..しかし、乱数で画像パスを取得するための変数を作成する方法が見つかりません作成した。
アップロードされたファイルの初期名のみ。これを実行してからデータベースに送信する更新ステートメントを作成する方法を知っている人はいますか?