File Upload - or why caffeine and nicotine nearly won the day
| From: | Julian Morcinek | Date: | Thu, 13 Jul 2000 22:40:37 +0000 |
| Subject: | File Upload - or why caffeine and nicotine nearly won the day | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6559@lists.php.net to get a copy of this message | ||
Hi List
Just implemented a file upload routine using V3.0.16 on Win NT. It worked
ok. Then tried to abstract the upload code by putting it in a function
within an include function library. Problems. Many hours of problems.
Used the form object file and posted, which worked previously, as below:
<input name='userfile' type='file'>
Created a function - with the identical code to the previous working
example, except for passing the form variable and the new name of the
uploaded file - like this:
function uploadImage($userfile,$newfilename)
Didn't work at all. After a while I de-bugged the passed function arguments
within the function itself. A list of results:
echo $userfile: c:\\test.gif (ok, an escaped slash)
echo $userfile_name: blank
echo $userfile_type: blank
echo $userfile_size: blank
Of course, the original variable OUTSIDE the function reported the correct
results. Thought a bit. The variable name $userfile is obviously a
construct. Tried passing it by reference:
function uploadImage(&$userfile,$newfilename)
Same problem. Does anybody out there in the PHP community have any ideas?
It can't be a bug. I've never, ever discovered a bug. Bit like winning the
Loser's Lottery. Always my code......
Julian