Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docs:browsers:posting_forms [2009/06/26 00:32] – billh | docs:browsers:posting_forms [2009/11/03 10:17] (current) – billh | ||
---|---|---|---|
Line 16: | Line 16: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | It is common to test for this to determine if a form was posted: | ||
+ | <code php> | ||
+ | if( $_POST ){ | ||
+ | // do something | ||
+ | } | ||
+ | </ | ||
+ | However, if the only thing in your form was a file input and a submit button, then the post array may be empty. | ||
+ | <code php> | ||
+ | if( $_FILES ){ | ||
+ | // do something | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== handling max file size during uploads ===== | ||
+ | It is advisable to handle file sizes during uploads. | ||
+ | <input type=" | ||
+ | </ | ||
+ | |||
+ | Once the form is posted, you can check for errors like this:< | ||
+ | if( $_POST ){ | ||
+ | if( isset($_FILES[' | ||
+ | if( $_FILES[' | ||
+ | // process the uploaded file | ||
+ | }else{ | ||
+ | // there was an error | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | You can run a switch/case block if you prefer, and handle each error code differently. | ||
+ | * http:// | ||
===== multi select as an array ===== | ===== multi select as an array ===== |