查看: 1125|回复: 9
|
[PHP] Upload and Resize的问题
[复制链接]
|
|
我在这个网看到这样的code.
http://www.fundisom.com/phparadise/php/image_handling/image_upload_and_resize#51
但是当我要run的时候没有问题。
but,要upload的时候就中招了。
下面是我的error message
- Warning: move_uploaded_file(pics/122935.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\share\upload2.php on line 18
- Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\uploadtemp\php11.tmp' to 'pics/122935.jpg' in D:\share\upload2.php on line 18
- Warning: chmod() [function.chmod]: No such file or directory in D:\share\upload2.php on line 19
- Warning: getimagesize(pics/122935.jpg) [function.getimagesize]: failed to open stream: No such file or directory in D:\share\upload2.php on line 20
- Warning: Division by zero in D:\share\upload2.php on line 21
- Fatal error: Call to undefined function ImageCreateTrueColor() in D:\share\upload2.php on line 30
复制代码
感觉上我好像少了一些东西。
我是用IIS+PHP5的。
谢谢 |
|
|
|
|
|
|
|
发表于 31-7-2006 07:15 PM
|
显示全部楼层
问题是出在$filedir,用full path吧。例如 c;/upload |
|
|
|
|
|
|
|

楼主 |
发表于 1-8-2006 09:14 AM
|
显示全部楼层
原帖由 苦瓜汤 于 31-7-2006 07:15 PM 发表
问题是出在$filedir,用full path吧。例如 c;/upload
这样的话不就是很麻烦了吗???
如果我还要upload上server的。。。。。
但结果是出error.
line 30
- $destimg=ImageCreateTrueColor($new_width,$new_height)
- or die('Problem In Creating image');
复制代码
Fatal error: Call to undefined function ImageCreateTrueColor() in D:\share\upload2.php on line 30 |
|
|
|
|
|
|
|
发表于 1-8-2006 01:07 PM
|
显示全部楼层
原帖由 红发 于 1-8-2006 09:14 AM 发表
这样的话不就是很麻烦了吗???
如果我还要upload上server的。。。。。
但结果是出error.
line 30
$destimg=ImageCreateTrueColor($new_width,$new_height)
or die('Problem In Creating image' ...
1。file path不同uri,比较好使用full path,把它放到一个variable或constant不怎么麻烦吧?
2。第二个error,检查一下你的gd extension有没有loaded。extension=php_gd2.dll
[ 本帖最后由 苦瓜汤 于 1-8-2006 01:08 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 2-8-2006 11:25 AM
|
显示全部楼层
原帖由 苦瓜汤 于 1-8-2006 01:07 PM 发表
1。file path不同uri,比较好使用full path,把它放到一个variable或constant不怎么麻烦吧?
2。第二个error,检查一下你的gd extension有没有loaded。extension=php_gd2.dll
可以upload了,但是。。。。
他的size没有变到。。。。
还中了一个error呢。
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'pics/small_122935.jpg' for writing in D:\share\upload2.php on line 36
Problem In saving |
|
|
|
|
|
|
|
发表于 2-8-2006 12:58 PM
|
显示全部楼层
原帖由 红发 于 2-8-2006 11:25 AM 发表
可以upload了,但是。。。。
他的size没有变到。。。。
还中了一个error呢。
Warning: imagejpeg() : Unable to open 'pics/small_122935.jpg' for writing in D:\share\upload2.php on line 36
Pr ...
你没有用 fullpath? 你的 path 是怎么样的? |
|
|
|
|
|
|
|

楼主 |
发表于 2-8-2006 01:15 PM
|
显示全部楼层
原帖由 goatstudio 于 2-8-2006 12:58 PM 发表
你没有用 fullpath? 你的 path 是怎么样的?
知道了原来这个也要。。。
- $thumbdir = 'D:/share/img'
复制代码
[ 本帖最后由 红发 于 2-8-2006 01:20 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 3-8-2006 10:01 AM
|
显示全部楼层
还有一个问题。。。
- <?php
- if(isset($_POST['Submit']))
- {
- $size = 150; // the thumbnail height
- $filedir = 'pics/'; // the directory for the original image
- $thumbdir = 'pics/'; // the directory for the thumbnail image
- $prefix = 'small_'; // the prefix to be added to the original name
- $maxfile = '2000000';
- $mode = '0666';
- $userfile_name = $_FILES['image']['name'];
- $userfile_tmp = $_FILES['image']['tmp_name'];
- $userfile_size = $_FILES['image']['size'];
- $userfile_type = $_FILES['image']['type'];
- IF ($userfile_type == "JPEG"){
- ................
- 。。。。。。。。
- }
- ELSE{
- header("Location: upload.php");
- }
复制代码
为何我要在手动refresh多一次他才会去到upload.php这里呢?
[/code] |
|
|
|
|
|
|
|
发表于 3-8-2006 10:18 AM
|
显示全部楼层
ELSE{
header("Location: upload.php");
}
[/red]
只要你上传的文件是JPEG都不会回到upload.php |
|
|
|
|
|
|
|

楼主 |
发表于 3-8-2006 10:40 AM
|
显示全部楼层
原帖由 苦瓜汤 于 3-8-2006 10:18 AM 发表
ELSE{
header("Location: upload.php");
}
只要你上传的文件是JPEG都不会回到upload.php
- <?
- $action=$_GET['action'];
- if ($action=="success") {
- echo "success";
- }else{
- echo "fail";
- }
-
- ?>
复制代码
为何我用IIS+PHP这样写会有error的???
Notice: Undefined index: action in D:\share\upload3.php on line 3
[ 本帖最后由 红发 于 3-8-2006 02:02 PM 编辑 ] |
|
|
|
|
|
|
| |
本周最热论坛帖子
|