[Klug-general] PHP Uploads

Athon Solo athon at athon.me.uk
Tue Feb 15 12:28:36 GMT 2005


It sounds like you're trying to use the old, pre-"register_globals = 
off" method of accessing uploaded files.

The current method uses the $_FILES super global array, the contents of 
which can be shown in a nicely formatted output using:
<pre><?php var_dump ($_FILES); ?></pre>

There's a good section in the php manual on file uploads at:
http://uk.php.net/manual/en/features.file-upload.php

If you want to read up more about the change to register_globals = off, 
and what it affects, check out:
http://php.net/register_globals and the documents that the page links to

Hope that helps

Allen


Karl Lattimer wrote:
> Kevin I have the code you seek, but not with me at present, I can email
> you it later on tonight...
> 
> file uploads are a strange one in php, but not too difficult to master.
> 
> Karl,
> 
> On Tue, 2005-02-15 at 09:04 +0000, 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>
>>
>>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
>>
> 
> 
> 
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/kent
> 
> 



More information about the Kent mailing list