× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks a million Brian,

This is a good way to start. Since I am new to PHP there is no way I could
even dream of this code. I'll give it a try.

BR
Ewart



BMay

From:
BMay@xxxxxxxxx


To:
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


Cc:



Date:
06/21/2010 07:27 PM


Subject:
Re: [WEB400] PHP to download any iSeries file in XL format to the
local directory



Ewart,

Here is one option.

<?php
// If the above is not the FIRST line in the php file, it WON'T
WORK!

// Retrieve input parameters
$directory = $_REQUEST['dir'];
$fileName = $_REQUEST['file'];

// make sure file exists
if (!file_exists("$directory/$fileName"))
{
die("File $directory/$fileName does not exist.");
}

// Tell the browser to open file as an attachment
header("Content-disposition: attachment; filename=$fileName");
header("Content-type: application/octet-stream");

// Stream file to browser
readfile("$directory/$fileName");

// Leave the script explicitly
exit;

?>

This should stream the specified file from the specified IFS directory to
the user's browser as an attachment. The browser will ask the user if
they want to save the file or open it. I hand typed this, so forgive me
if there is a typo in there.

HTH,

Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.