473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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.
Jul 17 '05 #1
2 2914
*** Mike escribió/wrote (18 Sep 2004 09:34:37 -0700):
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.


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
--
Jul 17 '05 #2
Mike wrote:
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.


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
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Joshua Beall | last post by:
Hi All, Is there any way for me to overcome the php.ini configuration upload_max_filesize? I cannot use ini_set() since upload_max_filesize can only be set in httpd.conf or php.ini. Are there...
0
by: Brian van den Broek | last post by:
Mark Devine said unto the world upon 2004-12-16 10:49: > Hi I'm brand new to python and I was wondering if anybody knew of a > easy way to change every character in a list into its lower case >...
0
by: DvDmanDT | last post by:
------=_NextPart_000_005C_01C35A2A.ECB5CE90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi everyone, I was wondering if there's any way I can...
3
by: kingsleymyers | last post by:
I have a client with a need for an "upload_max_filesize" directive in excess of 10MB. Their current host will not budge. They need something in the range of 15MB to 20MB. Will this require a...
1
by: Mick | last post by:
Hi there, I am using the following : - Win XP - Easyphp v 1-7 - PHP 4.3.10 I am getting the following error in my apache error log file when attempting
1
by: Divvy Bollocks | last post by:
// A big 7 and three-quarters size "Hello" to all C++ programmers out there. This here is the second program what I've // ever wrote, the first being a "Fuck off world you cunt" program. It's a...
6
by: hannu | last post by:
Hello all good PHP people I have a really frustrating problem with php5.1.2+apache2 on OpenSuse 10.1 (X86-64) environment. Though I set the upload_max_filesize setting in php.ini file to any...
1
by: pittendrigh | last post by:
If I want to control (max) upload file size on a Suse10.2 box running php5.0.3, in php.ini, does max_post_size matter? Or is upload_max_filesize the only relevant directive?
3
by: David | last post by:
I am puzzled, I want to change the upload_max_filesize setting, if I do this with ini_set('upload_max_filesize', 8000000); the upload_max_filesize is not set. However, if I make the change in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.