开发者

File upload change name gives error

开发者 https://www.devze.com 2023-03-31 19:09 出处:网络
$ref_id = mysql_insert_id(); $locatie = \'iso_photo/afwijkingen\'; if($_FILES[\'uploaded\'][\'type\'] != \'application/octet-stream\')// Geen php files
    $ref_id = mysql_insert_id();

$locatie = 'iso_photo/afwijkingen';

    if($_FILES['uploaded']['type'] != 'application/octet-stream')  // Geen php files
    {
        $folder = $locatie.basename($_FILES['uploaded'][$ref_id.'.jpg']) ;
        move_uploaded_file($_FILES['uploaded']['tmp_name'], $folder);
    }

Gives: Warning: move_uploaded_file(iso_photo/afwijkingen) [function.move-uploaded-file]: failed to open stream: Is a directory

Warning: move_uploaded_file() [function.move-uploaded-file开发者_如何学Go]: Unable to move '/tmp/php6LQCqY' to 'iso_photo/afwijkingen'

What might be wrong?


edited 4th line, should work now

$locatie = 'iso_photo/afwijkingen';

if($_FILES['uploaded']['type'] != 'application/octet-stream')  // Geen php files
{
    $folder = $locatie . "/" . basename($_FILES['uploaded'][$ref_id]) ;
    move_uploaded_file($_FILES['uploaded']['tmp_name'], $folder);
}

but can't properly say, as i don't know content of $ref_id variable

0

精彩评论

暂无评论...
验证码 换一张
取 消