473,383 Members | 1,840 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,383 software developers and data experts.

max_file_size

Does the hidden field MAX_FILE_SIZE have any effect on a file
submission that is too large (on the client side)? The PHP manual at
http://cn.php.net/manual/en/features.file-upload.php suggests that, if
MAX_FILE_SIZE is supplied, then a browser should warn the user that the
file they are attempting to upload is too large, and this would prevent
the user from needlessly uploading files that the server then tells
them is too large. I have tried tests on both FF 1.5 & IE 6, and both
submit a file that is too large as indicated by the MAX_FILE_SIZE
field. The relevant HTML code I'm using is showed below.

<form enctype="multipart/form-data" method="post">
<input type="text" value="'.$filePath.'" />
<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxSize.'" />
<input type="file" id="fileInput" name="theFile" />
<input type="hidden" name="formnumber" value="'.$fileNumber.'" /'
<input type="submit" name="submit" />
</form>

Thanks

taras

Jul 11 '06 #1
4 21008
On 10 Jul 2006 19:38:57 -0700, ta******@gmail.com wrote:
The relevant HTML code I'm using is showed below.

<form enctype="multipart/form-data" method="post">
<input type="text" value="'.$filePath.'" />
<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxSize.'" />
^^ ^^ ^
Pardon me if this is a silly question due to my limited knowledge of PHP
but why have you got the single quotes and dots surrounding $maxsize ?
Also the /at the end looks like XHTML not HTML.

I just tested a similar upload form with MAX_FILE_SIZE set to 1500 and
neither Opera 8 or IE 5.5 complained about larger files. It does seem
pretty useless.

--
Steven
Jul 11 '06 #2
ta******@gmail.com writes:
Does the hidden field MAX_FILE_SIZE have any effect on a file
submission that is too large (on the client side)? The PHP manual at
http://cn.php.net/manual/en/features.file-upload.php suggests that, if
MAX_FILE_SIZE is supplied, then a browser should warn the user that the
file they are attempting to upload is too large
Here's the actual text from that page:

"The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file
input field, and its value is the maximum filesize accepted. This is an
advisory to the browser, PHP also checks it. Fooling this setting on the
browser side is quite easy, so never rely on files with a greater size
being blocked by this feature."

I don't know of any browsers that take PHP's "advisory" into account, and I
don't see anything at <http://w3c.orgthat indicates they should.

The primary, and in practical terms *only*, use for MAX_FILE_SIZE is for
server-side checking.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Jul 11 '06 #3
Sherm Pendley wrote:
ta******@gmail.com writes:
>Does the hidden field MAX_FILE_SIZE have any effect on a file
submission that is too large (on the client side)? The PHP manual at
http://cn.php.net/manual/en/features.file-upload.php suggests that, if
MAX_FILE_SIZE is supplied, then a browser should warn the user that the
file they are attempting to upload is too large

Here's the actual text from that page:

"The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file
input field, and its value is the maximum filesize accepted. This is an
advisory to the browser, PHP also checks it. Fooling this setting on the
browser side is quite easy, so never rely on files with a greater size
being blocked by this feature."

I don't know of any browsers that take PHP's "advisory" into account, and I
don't see anything at <http://w3c.orgthat indicates they should.
Exactly. How could someone who creates a server-side technology expect
to decree browser behavior and have it magically happen? Or that even in
future versions, browser makers would automatically implement his
decree? If such a feature were to be implemented in HTML at all, it
would be as an attribute of the file-type INPUT tag.
Jul 11 '06 #4
Thanks for the replies everyone.

It seems like an obvious feature to have in browsers, so I'm wondering
why it hasn't been implemented (even if it isn't part of the HTML
standards yet)

Taras

Jul 14 '06 #5

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

Similar topics

1
by: bongoman | last post by:
Hi there I'm working with file uploads and PHP. My upload form has a hidden input with a MAX_FILE_SIZE name. I'm curious how to error handle when this lmit is exceeded. What is the best way...
3
by: Bob Bedford | last post by:
Until now, the MAX_FILE_SIZE directive wasn't taken when uploading files. Since 2-3 days, the browser (IE6) doesn't seem to send files bigger than MAX_FILE_SIZE. The limited action seems to be...
16
by: Mark Hamptons | last post by:
Hi, I've scoured sites like Bravenet but cannot find what I want, which is a ready to go tool that will let me place an Upload button on my web site. When clicked this will give the visitor a...
2
by: Dan | last post by:
Hi, I know this code is not entirely javascript, but bare with me. Can you please tell me why this does not work: page: filemanager.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
2
by: underground | last post by:
I need a little help figuring this one out. I have a script that should post mutiple binary files into a single row but instead of copying the indiviuals files it rewrites the first file to all the...
10
by: underground | last post by:
I need a little help figuring this one out. I have a script that I've modified to post mutiple binary files into a single row but instead of copying the indiviuals files it rewrites the first file to...
13
by: underground | last post by:
I have been working around this for sometime. I can update text feilds but have ran into a problem with this script from a previous post. I'm trying to update data store in mysql see below example.....
23
by: guile | last post by:
hi, I tried to lookup on w3c website for information on the MAX_FILE_SIZE hidden field to restrict the size of file uploads, but couldn't find much. Looked up elsewhere, but generally, couldn't find...
2
by: Mike | last post by:
Hello, I have a page that uploads a file. It has a form and uses SELF to process the file the second time around. I have MAX_FILE_SIZE set. The problem is, if the file is too big I cant check...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.