I have a problem uploading files with PHP which has me stumped! I am unable
to successfully upload files. My simple test script is as follows:
<?php
if (count($_FILES) )
{
var_dump($_FILE S) ;
}
if (is_uploaded_fi le($_FILES['toProcess']['tmp_name']))
{
print "<h3>File successfully upload.</h3>" ;
print "<a href=\"{$_SERVE R['PHP_SELF']}\">Try again?<br>" ;
}
else
{
print <<< __RAWHTML__
<form enctype="multip art/form-data" action="{$_SERV ER['PHP_SELF']}"
method="post">
<input type="hidden" name="MAX_FILE_ SIZE" value="10240000 ">
Filename: <input name="toProcess " type="file">
<input type="submit" value="upload">
</form>
__RAWHTML__;
print "<br><a href=\"{$_SERVE R['PHP_SELF']}\">Try again?<br>" ;
}
?>
When I run it I get the following back:
array(1) { ["toProcess"]=> array(5) { ["name"]=> string(12) "100_2038.J PG"
["type"]=> string(0) "" ["tmp_name"]=> string(0) "" ["error"]=> int(1)
["size"]=> int(0) } }
Obviously I have some sort of error as my "tmp_name" key is null and the
"error" key is 1.
Any ideas or suggestions? I am running IIS with PHP 4.3.4. I checked my
php.ini file and the settings for uploading files look good to me:
;;;;;;;;;;;;;;; ;
; File Uploads ;
;;;;;;;;;;;;;;; ;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if
not
; specified).
upload_tmp_dir = c:\windows\temp
; Maximum allowed size for uploaded files.
upload_max_file size = 1G
Thanks for any help or suggestions.
Mike
--
Mike Walsh - mike_walsh at mindspring.com
to successfully upload files. My simple test script is as follows:
<?php
if (count($_FILES) )
{
var_dump($_FILE S) ;
}
if (is_uploaded_fi le($_FILES['toProcess']['tmp_name']))
{
print "<h3>File successfully upload.</h3>" ;
print "<a href=\"{$_SERVE R['PHP_SELF']}\">Try again?<br>" ;
}
else
{
print <<< __RAWHTML__
<form enctype="multip art/form-data" action="{$_SERV ER['PHP_SELF']}"
method="post">
<input type="hidden" name="MAX_FILE_ SIZE" value="10240000 ">
Filename: <input name="toProcess " type="file">
<input type="submit" value="upload">
</form>
__RAWHTML__;
print "<br><a href=\"{$_SERVE R['PHP_SELF']}\">Try again?<br>" ;
}
?>
When I run it I get the following back:
array(1) { ["toProcess"]=> array(5) { ["name"]=> string(12) "100_2038.J PG"
["type"]=> string(0) "" ["tmp_name"]=> string(0) "" ["error"]=> int(1)
["size"]=> int(0) } }
Obviously I have some sort of error as my "tmp_name" key is null and the
"error" key is 1.
Any ideas or suggestions? I am running IIS with PHP 4.3.4. I checked my
php.ini file and the settings for uploading files look good to me:
;;;;;;;;;;;;;;; ;
; File Uploads ;
;;;;;;;;;;;;;;; ;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if
not
; specified).
upload_tmp_dir = c:\windows\temp
; Maximum allowed size for uploaded files.
upload_max_file size = 1G
Thanks for any help or suggestions.
Mike
--
Mike Walsh - mike_walsh at mindspring.com
Comment