Php uploadifive-上载时更改文件名

Php uploadifive-上载时更改文件名,php,javascript,jquery,uploadify,Php,Javascript,Jquery,Uploadify,我正在使用uploadifive上传图像-但是我想将图像的名称更改为“newimage”,我不确定在何处或如何使用提供的内容执行此操作-这是我需要部署的最后一次修改 $file = 'uploaded_img.jpg'; $remote_file = 'Saved.txt'; ftp_put($conn_id, $remote_file, $file, FTP_ASCII) 只需更改远程文件的名称您将需要在处理上传的PHP脚本中进行名称更改(我假设您使用PHP,因为这是Upldfy的标准)。

我正在使用uploadifive上传图像-但是我想将图像的名称更改为“newimage”,我不确定在何处或如何使用提供的内容执行此操作-这是我需要部署的最后一次修改

$file = 'uploaded_img.jpg';
$remote_file = 'Saved.txt';

ftp_put($conn_id, $remote_file, $file, FTP_ASCII)

只需更改远程文件的名称

您将需要在处理上传的PHP脚本中进行名称更改(我假设您使用PHP,因为这是Upldfy的标准)。这可能有点棘手,因为必须将传入文件名与其扩展名分开。这应该足以让你开始

    $theFile = $_FILES['file_upl']['name'];
    $tempFile = $_FILES['file_upl']['tmp_name'];
    $newName = "newname";
    $saveDir = $_SERVER['DOCUMENT_ROOT']."/images/";

    //Function returns the extension from the '.' on
    function get_ext($from_file) { 
        $ext = strtolower(strrchr($from_file,'.'));
        return $ext;
    }

    //This will rename the file to $newname + the extension
    $theFile = $newname.get_ext($theFile);

//Save the file
    move_uploaded_file($tempFile,$saveDir.$theFile);