php 2文件输入字段

时间:2012-07-12 06:59:31

标签: php

我有一个包含2个文件输入字段的表单,但它只从输入字段上传其中一个文件(第一个“u_img”)。下面是输入字段

<input name="u_img" type="file" />
<input name="u_upload" type="file" />

我正在使用这个php上传它。

$pic_upload_path = "/home/users/A006193/fgpostbus.nl/www.fgpostbus.nl/enquete/";

// foto 1
if (is_uploaded_file($_FILES['u_upload']['tmp_name']))
{
$pic_loc_1 = $pic_upload_path.md5(time()).'_'.$_FILES['u_upload']['name'];
$rel_pic_loc_1 = "enquete/";
    if (move_uploaded_file($_FILES['u_upload']['tmp_name'],$pic_loc_1))
    {
    //echo "Het bestand is verplaatst naar $pic_loc1!";
    }
$rel_pic_loc_1 .= "".md5(time()).'_'.$_FILES['u_upload']['name']."";
}

if (is_uploaded_file($_FILES['u_img']['tmp_name']))
{
$pic_loc_2 = $pic_upload_path.md5(time()).'_'.$_FILES['u_img']['name'];
$rel_pic_loc_2 = "enquete/";
    if (move_uploaded_file($_FILES['u_img']['tmp_name'],$pic_loc_2))
    {
    //echo "Het bestand is verplaatst naar $pic_loc2!";
    }
$rel_pic_loc_2 .= "".md5(time()).'_'.$_FILES['u_img']['name']."";
}

我一直在看这个年龄,我不明白为什么它不起作用。

加入:

来自print_r($ _ FILES);

的结果
Array
(
[u_img] => Array
    (
        [name] => natasha.jpg
        [type] => image/jpeg
        [tmp_name] => /tmp/phpXU56Pg
        [error] => 0
        [size] => 5414
    )

[u_upload] => Array
    (
        [name] => DSC_0003.jpg
        [type] => image/jpeg
        [tmp_name] => /tmp/phpb4vAZj
        [error] => 0
        [size] => 110476
    )

)

0 个答案:

没有答案