PHP – validate a form before the file uploads -
i have html form file input, submitted ajax upload.php
. php script performs number of tests detect invalid submissions, e.g., checking encrypted timestamp, , either return error or process uploaded file.
the question is: possible perform server-side tests , return error before server receives entire file? save time , bandwidth.
no, if have 1 form ascii data , binary (uploads), it's 1 request. uploads stored in temp directory of server till move them.
but, can 2 things:
- check cientside , start upload if check ok
- extract upload function rest of post. can example upload in 'background', check on server side, etc., separated rest of form , submit.
i prefer no. 2. it's performance , user experience (e.g. large files).
Comments
Post a Comment