【问题标题】:Input file in wideimage宽幅图像中的输入文件
【发布时间】:2012-07-28 17:24:32
【问题描述】:

我有这些代码。在form.html:

<form name="form2" method="post" action="lagarto.php" />
<input type="file" size="32" name="myimg" value="" />
<input type="submit" name="Submit" value="upload" />
</form>

lagarto.php:

 <?php 

require( "./lib/WideImage.php");

$myimg = $_FILES['myimg']['tmp_name'];  // <-- Note this addition
$image = WideImage::load($myimg);



$image = WideImage::load($img);


$image->output('jpg', 90);

    ?>

它应该显示图像输出,但我收到以下错误消息:

注意:未定义的索引:C:\Arquivos de 中的 myimg 程序\EasyPHP-5.3.9\www\wideimage-11.02.19-full\lagarto.php 上 第 6 行

致命错误:未捕获的异常 带有消息“字符串”的“WideImage_InvalidImageSourceException”没有 包含图像数据。在 C:\Arquivos de 程序\EasyPHP-5.3.9\www\wideimage-11.02.19-full\lib\WideImage.php:240 堆栈跟踪:#0 [内部函数]:WideImage::loadFromString(NULL) #1 C:\Arquivos de programas\EasyPHP-5.3.9\www\wideimage-11.02.19-full\lib\WideImage.php(184): call_user_func(Array, NULL) #2 C:\Arquivos de 程序\EasyPHP-5.3.9\www\wideimage-11.02.19-full\lagarto.php(8): WideImage::load(NULL) #3 {main} 在 C:\Arquivos de 中抛出 程序\EasyPHP-5.3.9\www\wideimage-11.02.19-full\lib\WideImage.php 在第 240 行

有什么想法吗?

编辑: 我尝试将这些行添加到我的代码中:

$_FILES = $HTTP_POST_FILES;
$img = $FILES['myimg']['tmp_name'];

我什至只尝试了其中一行。什么都没有改变。

【问题讨论】:

  • 我更新了我的代码但没有成功...有什么想法吗?

标签: php html image input


【解决方案1】:

$myimg 不会根据表单自动设置,并且您从未声明过它。

您需要定义$myimg

$myimg = $_FILES['myimg']['tmp_name'];  // <-- Note this addition
$image = WideImage::load($myimg);

【讨论】:

    【解决方案2】:

    我记得我有同样的问题。解决方案是将图像表单系统临时文件夹复制到本地文件夹,然后通过加载程序访问它。 (另一个原因可能是临时名称中的文件后缀错误。)

    【讨论】:

    • 我会试试你说的。谢谢你。但我仍在寻找另一种解决方案或另一种解释。谢谢
    猜你喜欢
    • 2013-09-29
    • 2014-05-24
    • 2020-10-15
    • 2020-04-17
    • 2018-05-30
    • 2016-04-01
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    相关资源
    最近更新 更多