Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 09:40 AM
Mike
Guest
 
Posts: n/a
Default Lowering upload_max_filesize

I want to allow my students to upload small text files (perhaps just a
few bytes in size) just to show them how to upload using a PHP form.
For security reasons -- I don't want them uploading MP3 files for
example -- I changed the upload_max_filesize setting in PHP.INI from
the default "2M" to "1024". However I am still able to upload files
larger than 1024 bytes. How do I specify that the filesize limit is in
bytes and not megabytes? Thanks in advance.
  #2  
Old July 17th, 2005, 09:40 AM
Alvaro G. Vicario
Guest
 
Posts: n/a
Default Re: Lowering upload_max_filesize

*** Mike escribió/wrote (18 Sep 2004 09:34:37 -0700):[color=blue]
> I want to allow my students to upload small text files (perhaps just a
> few bytes in size) just to show them how to upload using a PHP form. For
> security reasons -- I don't want them uploading MP3 files for example --
> I changed the upload_max_filesize setting in PHP.INI from the default
> "2M" to "1024". However I am still able to upload files larger than 1024
> bytes. How do I specify that the filesize limit is in bytes and not
> megabytes? Thanks in advance.[/color]

This is what manual says, I hope it helps:

http://es.php.net/manual/en/ini.sect...d-max-filesize

upload_max_filesize integer

The maximum size of an uploaded file.

When an integer is used, the value is measured in bytes. You may also use
shorthand notation as described in this FAQ.

http://es.php.net/manual/en/faq.usin...shorthandbytes

15. A few PHP directives may also take on shorthand byte values, as
opposed to only integer byte values. What are all the available shorthand
byte options? And can I use these outside of php.ini?

The available options are K (for Kilobytes) and M (for Megabytes), these
are case insensitive. Anything else assumes bytes. 1M equals one Megabyte
or 1048576 bytes. 1K equals one Kilobyte or 1024 bytes. You may not use
these shorthand notations outside of php.ini, instead use an integer value
of bytes. See the ini_get() documentation for an example on how to convert
these values.

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
  #3  
Old July 17th, 2005, 09:40 AM
John Dunlop
Guest
 
Posts: n/a
Default Re: Lowering upload_max_filesize

Mike wrote:
[color=blue]
> I want to allow my students to upload small text files (perhaps just a
> few bytes in size) just to show them how to upload using a PHP form.
> For security reasons -- I don't want them uploading MP3 files for
> example -- I changed the upload_max_filesize setting in PHP.INI from
> the default "2M" to "1024". However I am still able to upload files
> larger than 1024 bytes. How do I specify that the filesize limit is in
> bytes and not megabytes? Thanks in advance.[/color]

An integer value is taken to be in bytes. You can
explicitly label it as kilobytes if you like by using the
other shorthand notation, where '1K' equals '1024'. What
does ini_get('upload_max_filesize') give?

HAGW!

--
Jock
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles