SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Checking the size of a file!
-
Dec 14, 2002, 18:53 #1
- Join Date
- Jun 2002
- Posts
- 53
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Checking the size of a file!
Hi all
I would like to tell me the way that i can check the file size which is gonna be uploaded via a form.
Are there relative tutorials?
-
Dec 14, 2002, 19:58 #2
- Join Date
- Mar 2002
- Location
- Svíþjóð
- Posts
- 4,080
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Check the file size before the form is submitted?
Can't be done...
-
Dec 15, 2002, 06:00 #3
- Join Date
- Jun 2002
- Posts
- 53
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
actually, i use php. So there are bugs when i am cheching the files.
If you have a form with too many fields and an upload input as well, then if you submit them and accidentally someone submit a big file the an error occurs by the system.I suppose you know script languages server side and especially php so when the error happens the all the data in the fields that the users had previously submitted is gonna to be lost, Am i right?
I want to predict this and in the worst case i want the user to be able to go to the from with the data in the fields.
How could i make it?
-
Dec 15, 2002, 06:12 #4
- Join Date
- Mar 2002
- Location
- Svíþjóð
- Posts
- 4,080
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Have to correct myself; you can add a hidden form field called MAX_FILE_SIZE
The MAX_FILE_SIZE is advisory to the browser. It is easy to circumvent this maximum. So don't count on it that the browser obeys your wish! The PHP-settings for maximum-size, however, cannot be fooled.
http://www.php.net/manual/en/feature...ad.post-method
-
Dec 15, 2002, 06:23 #5
- Join Date
- Jun 2002
- Posts
- 53
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have tried that, but id somene uploads a file bigger than 2 Mb then an error from the php core occurs (php.ini) i am not allowed to touch the php.ini
So i want to predict the worst case and the user doesn't loose his data( think the case that there is a TEXTAREA and the user has written a huge text, like forums.)
Then what i have to do?
-
Dec 15, 2002, 06:40 #6
- Join Date
- Mar 2002
- Location
- Svíþjóð
- Posts
- 4,080
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Check the length of the textarea value before the form is submitted? Can be done with javascript
-
Dec 15, 2002, 07:48 #7
- Join Date
- Jun 2002
- Posts
- 53
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You mean to store the value of the text?
Do you know any relevant tutorial?
Bookmarks