[Klug-general] PHP Uploads

Kevin Groves kgroves at ksoft-creative-projects.co.uk
Tue Feb 15 13:36:07 GMT 2005


Alex A. Smith MCP wrote:

> What encoding type do you have set on the form?
>
> in theroy this should upload a file - wont do any moving of the file 
> from the temp folder tho but i'll assume that your doing that already. 
> if not i can post that too.
>
> <form enctype="multipart/form-data" method="post">
> <input type="hidden" name="MAX_FILE_SIZE" value="51200">
> <input type="file" name="fupload"><br>
> <input type="submit" value="Upload">
> </form>
>

Yes got all that but if I use this:


<?php
global $userfile, $userfile_name, $userfile_size, $userfile_type;

echo "1.".$userfile, "1.".$userfile_name, "1.".$userfile_size, 
"1.".$userfile_type;
echo $MAX_FILE_SIZE;



?>

<form enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="userfile"><br>
<input type="submit" value="Upload">
</form>




When I submit I thought the values $userfile etc will at least be 
defined but for me nothing's there.

Kev,






> Alex
>
> ---
> Alex A. Smith
> IT Tech Temple School, Rochester
> Web Host - ASMHosting.com
> General IT lay about
> ----- Original Message ----- From: "Kevin Groves" 
> <kgroves at ksoft-creative-projects.co.uk>
> To: "Kent Linux User Group - General Topics" <kent at mailman.lug.org.uk>
> Sent: Monday, February 14, 2005 10:35 PM
> Subject: [Klug-general] PHP Uploads
>
>
>> Hi,
>>
>> This is driving me mad. Note sure if it's a system config error, it's 
>> late and I'm tired or my PHP is wrong....
>>
>> Trying to upload a file with the <input type="file" name="testfile"> 
>> tag.
>>
>>
>> I gather I should have, on page submission some global vars such as 
>> 'testfile', 'testfile_name' and 'testfile_size'. Is that right?
>>
>> I try to echo them but get nothing. There is no suitable pause on 
>> page submission to sugest the files are being upload (ok local 
>> webserver but I should get something) even with a half meg file. It 
>> just returns instantly.
>>
>> My php.ini does have 'upload file' switched on and there no files 
>> being thrown away in I can see them.
>>
>> For this to work do I *have* to process the data stream which is why 
>> the page is falling out? I hate this is kind of thing, it's *SO* easy 
>> doing this in Coldfusion!
>>
>> Thanks for any pointers....
>>
>> Kev,
>>
>>
>> _______________________________________________
>> Kent mailing list
>> Kent at mailman.lug.org.uk
>> http://mailman.lug.org.uk/mailman/listinfo/kent
>>
>>
>
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/kent
>


-- 
Kevin Groves                               VAT No: 776 2747 86
kSoft Creative Projects                    Tel/Fax: 01304 210153
http://www.ksoft-creative-projects.co.uk   Mobile: 0790 0230783
Yahoo!: ksoftcreativeprojects




More information about the Kent mailing list