lutrella@gmail.com Posted July 20, 2007 Share Posted July 20, 2007 I was wondering could i add a progress bar or stat bar for the file upload to this code below? ftp form: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style4 {font-size: x-small} .style6 {font-size: xx-small} .style7 {font-size: x-small; color: #000000; } --> </style> </head> <body> <code> <form enctype="multipart/form-data" action="upload.php" method="post"> <p><br> <input type="hidden" name="MAX_FILE_SIZE" value="2000000000000" /> <br> Send this file:</p> <p> <input name="userfile" type="file" /> </p> <p><br> <input type="submit" value="Send File" /> <br> </p> </form></code> --> </body> </html> the php file: <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. In PHP versions earlier than 4.0.3, use copy() and // is_uploaded_file() instead of move_uploaded_file. $ftp_server = "tttt"; $ftp_user = "ttt"; $ftp_pass = "tt"; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); // try to login if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected as $ftp_user@$ftp_server\n"; } else { echo "Couldn't connect as $ftp_user\n"; } $remote_file = $_FILES['userfile']['name'];; //I used these for debugging echo $_FILES['userfile']['name']; echo "<br>"; echo $_FILES['userfile']['type']; echo "<br>"; echo $_FILES['userfile']['size']; echo "<br>"; echo $_FILES['userfile']['tmp_name']; echo "<br>"; echo $_FILES['userfile']['error']; echo "<br>"; //v important this one as you have to use the tmp_file created for the actual upload $file = $_FILES['userfile']['tmp_name']; if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> could i add a progress bar or stat bar for the file upload to this code below? Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 20, 2007 Share Posted July 20, 2007 Ajax/Javascript. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.