× 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.



How do I use FTP or the filesystem classes to move files back and forth
between the iSeries and remote servers\directories?



When I try this code:



<?php

print ("trying to copy file...");

$fromFile = "php_filesystem_test.txt";

$toFile = "\\\\MyServer\\MyDirectory\\php_filesystem_test.txt";

$copyResult = copy($fromFile, $toFile);

?>



it simply creates a file named
"\\MyServer\MyDirectory\php_filesystem_test.txt" in the same IFS
directory as the original "php_filesystem_test.txt" file.



So, I tried this code:



<?php

print ("trying to move file...");

$from_file = "php_filesystem_test.txt";

$to_file = "\\\\il-psdbqa01\\FIN\\";

$move_result = move_uploaded_file($from_file, $to_file);

echo $move_result;

?>



but this did not work, either. The $move_result variable either
contained no information or was not echoed to the screen. I don't know
why this didn't work.



I next tried FTP. I created this script and ran it in the debugger (Zend
Studio for Eclipse - i5 Edition):



<?php

$conn = ftp_connect("systemi");

if ($conn) {

echo "connection successful";

if (ftp_login($conn,"username","password")) {

echo "login successful";

if
(ftp_get($conn,"php_filesystem_test.txt","/www/zendcore/htdocs/myFolder/
myFile.txt",FTP_ASCII)) {

echo "ftp put successful";

} else {

echo "ftp put not successful";

}

} else {

echo "ftp login not sucessful";

}

$close = ftp_close($conn);

} else {

echo "failed to connect";

}

?>



and it worked. It transferred a file from an IFS directory on the
iSeries to a project directory on my laptop.



But, if I try to run the same script in the i5 Zend Core, I get the HTTP
500 error page: "The website cannot display the page. Most likely
causes: The website is under maintenance. The website has a programming
error." It won't even execute the first line. I comment out all lines
but the first one and I still get the HTTP 500 error. I even restarted
my Apache server instance from the zcmenu to make sure I was picking up
the right php script and not something cached.



I've looked in the Zend Core user guide, the IBM Redbook for Zend on i5,
and in past messages in Zend for i5 forum...but no help.



Thanks,

Kelly




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.