Jump to content

Ftp Form-could i add a progress bar or stat bar for the file upload?


Recommended Posts

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?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.