$_FILES doesn't work but $_POST works
| From: | kartikay malhotra | Date: | Wed, 31 May 2006 05:25:10 +0000 |
| Subject: | $_FILES doesn't work but $_POST works | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237130@lists.php.net to get a copy of this message | ||
Hi All,
I'm using Mbuni MMS gateway, which provides me the facility to upload .mms
files.
Now with my little exposure to PHP, to upload files (say from the browser),
I use $_POST, namely:
if($_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
...
...
}
However, with Mbuni MMS Gateway (which provides HTTP POST), the above
condition in if loop isn't satisfied. I think $_FILES isn't working. However
the following code works:
<?php
$in='/usr/share/wallpapers/alien-night.jpg';
$out='/tmp/alien.jpg';
if(isset($_POST['userfile'])/* || $_FILES['userfile']['size'] > 0*/ )
{
$f=fopen($out,'a');
echo "HELOOOOOOOOOOOOOOOOOOOO";
copy($in, $out);
}
?>
This implies, $_POST works, and a file has been uploaded. I however, do not
know how to access it
How to access the uploaded file, determine its size and save its contents in
a database?
Thanks in advance
KM