I don't know the specific answer about whether 'upload_max_filesize' can be set within a script, but it seems to me that developers need to realize that uploading via PHP (or any language) has several limitations and 'upload_max_filesize' is only one of them. For example, you also have to deal with the maximum script execution time. On shared hosts, you're unlikely to be able to override these settings.
And while users generally have pretty fast download speeds these days, upload speeds are almost always much slower. Even if you can work around the php_ini settings, one or two users trying to upload a handful of multi-megabyte image files can slow your server to a crawl.
If you really want to provide this capability, you'll probably need a fast dedicated server. Failing that, the best route might be a solution that relies on FTP rather than HTTP. There are some Java applets out there like JUPload that might help.