When we wanted a handout upload facility for our conference speakers,
we started with FUPLOAD (much of the rest of the SystemiDeveloper.com
site is done in CGIDEV2) but it was just too slow. There are several
performance boosts that could have been made to the code (for example
replacing the byte-by-byte copying process) but we decided instead to
look for an alternative as we want the site to be both practical and
an example of what we preach. Net.Data was ruled out as it is
obsolete to all intents and purposes - IBM "i" now being the only
platform that supports it. Instead we used PHP. The CGIDEV2
application builds the web page from which the speaker selects which
files to upload. Once he has done so the form invokes the PHP script
- from which the following is the core code. Very simple and works
beautifully. It is actually a bit longer than need be because this
version was written to be step-by-step so we could debug easily.
$files = count( $_FILES );
for($file = 0; $file < $files; $file ++) {
$fileName = 'File' . $file;
$sessionId = $_POST ['Session'] [$file];
// Original name and size retirieved for testing purposes only
$originalName = $_FILES [$fileName] ['name'];
$fileSize = $_FILES [$fileName] ['size'];
// Copy the uploaded file(s) to final location.
if (move_uploaded_file ( $_FILES [$fileName] ['tmp_name'], "/
sidcd/pdf/$sessionId.pdf" ))
" {
$message = 'Uploaded';
} else {
// Handle error conditions
}
There are so many of these kinds of powerful functions in PHP that
we'll be using it a lot more in the future, for mailing, PDF
conversion, XMNL handling, etc.
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.