|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-10 10:32 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 04:00:01 2025 UTC |
This is odd to me, I am making a small FTP upload client for my webpage. What is odd about this, is the one that POSTS to itself doesn't work, however the other one I have, which has EXACTLY the same php code and is two separate pages works. I CAN'T FIGURE THIS OUT, HELP ! ! ---------- s4.php (POST TO ITSELF) ---------- <? function upload(){ $server = "jd-mason.com"; $con = ftp_connect($server); $user = "jd-mason"; $pass = "grammer"; ftp_login ($con, $user, $pass); ftp_cdup($con); ftp_pwd($con); ftp_chdir($con, 'home/public_html/PHP_scripts/'); ftp_pwd($con); $upload = ftp_put($con, $destination_file, $source_file, FTP_BINARY); ftp_close($con); }; ?> <html> <body marginwidth=4 marginheight=4 topmargin=4 leftmargin=4 bgcolor=white vlink="#0000ff" link="#0000ff"> FILE UPLOAD <P> <form method=POST action="s4.php" enctype="multipart/form-data"> Source File:<input type=file name=source_file size=20><BR> Destination File:<input type=text name=destination_file size=20><BR> <input type=submit name=Submit value=Submit size=20 style="border: 1px solid #0000FF"></form> <? if(isset($HTTP_POST_VARS[Submit])){ upload(); }; ?> </body> </html> ---------- h.html (POST TO s4_backup.php) ---------- <html> <body marginwidth=4 marginheight=4 topmargin=4 leftmargin=4 bgcolor=white vlink="#0000ff" link="#0000ff"> FILE UPLOAD <P> <form method=POST action="s4.php" enctype="multipart/form-data"> Source File:<input type=file name=source_file size=20><BR> Destination File:<input type=text name=destination_file size=20><BR> <input type=submit name=Submit value=Submit size=20 style="border: 1px solid #0000FF"></form> </body> </html> ---------- s4_backup.php ---------- <? function upload(){ $server = "jd-mason.com"; $con = ftp_connect($server); $user = "jd-mason"; $pass = "grammer"; ftp_login ($con, $user, $pass); ftp_cdup($con); ftp_pwd($con); ftp_chdir($con, 'home/public_html/PHP_scripts/'); ftp_pwd($con); $upload = ftp_put($con, $destination_file, $source_file, FTP_BINARY); ftp_close($con); }; ?> THESE LAST TWO WORK ! ! WTF IS GOING ON !