English 中文(简体)
零美元
原标题:$_files[ photo ]; is empty
  • 时间:2014-11-15 14:41:57
  •  标签:
  • php
  • upload

我正试图打上图像的纸面,但笔记本(照片)是空洞的。

$_FILES[ photo ][ name ];
$_FILES[ photo ][ size ];
$_FILES[ photo ][ type ];
$_FILES[ photo ][ tmp_name ];
$_FILES[ photo ][ error ];

当我回头来时,他们都绝对没有回去。

if($_FILES[ photo ][ name ])
{

if(!$_FILES[ photo ][ error ])
{
    $new_file_name = strtolower($_FILES[ photo ][ name ]); 
    if($_FILES[ photo ][ size ] > (1024000)) 
    {
        $valid_file = false;
        $msg =  Oops!  Your file s size is to large. ;
        echo $msg;
    }

    if($valid_file)
    {
        move_uploaded_file($_FILES[ photo ][ tmp_name ],  images/thumbnails/ .$new_file_name);
        $msg =  Congratulations!  Your file was accepted. ;
        echo $msg;
    }
}

else
{
    $msg =  Ooops!  Your upload triggered the following error:   .$_FILES[ photo ][ error ];
    echo $msg;
}
}

我是否犯过错?

<form action= ?p=post  method= POST >
            <input type= file  name= photo  size= 25  />
            <input type= submit  value= Posten  name= submit  /><br />
            </form>
最佳回答

您的表格缺乏一个基本部分 = 和;enctype=“倍数/正数”以你的形式添加。

<form action= ?p=post  method= POST  enctype= multipart/form-data >
  • The data encoding type is required when uploading files.

咨询:

问题回答

Türkiyeden Selamlar,

Yaklaşirk 8 saattir bu hatayHE çözmeye çalshiyordum AraştHEmadğmsite kalmadHE en sonunda senin yorumunu gördüm ve sorunum çözüldü dostum teşekkür ederim. 8 saat sonunda bu kadar ufak bir şeyden sorunun çkmasir beni hem hüzünlendirdi hem de sevindirdi her şey için teşekkürler.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签