lutrella@gmail.com Posted July 19, 2007 Share Posted July 19, 2007 Ftp Form help-- when the file uploads to the server, it doesnt upload the full file to the server? When it uploads a 1mb file only uploads 330k! the form is the code below in a file named = ftpupload.htm : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <code> <form enctype="multipart/form-data" action="upload.php" method="post"> <p><br> <input type="hidden" name="MAX_FILE_SIZE" value="200000000" /> <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 is the code below in a file named = upload.php : <?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 = "mysite.com"; $ftp_user = "name"; $ftp_pass = "pass"; // 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_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> thanks! Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted July 19, 2007 Share Posted July 19, 2007 It could be your connection time_out if your have a slow connection. or execute time_out Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 19, 2007 Author Share Posted July 19, 2007 I'm on a t1 line right now. Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted July 19, 2007 Share Posted July 19, 2007 your connected to a T1 say is the server dial-up then your fasted speed will be the dial-up T1 dont mean much at that point. try to ping the server. look at file size limits Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 19, 2007 Author Share Posted July 19, 2007 well! when i'm uploading its to a go daddy server account. my site is on go daddy.com. Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted July 19, 2007 Share Posted July 19, 2007 do they have file size limits set of execution time_out set Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 19, 2007 Author Share Posted July 19, 2007 I didnt see anything about file size limits set of execution time_out set. Quote Link to comment Share on other sites More sharing options...
Carterhost Posted July 19, 2007 Share Posted July 19, 2007 Create a new file: phpinfo.php Put this inside it: <?php echo phpinfo(); ?> View that in a browser, then look through that for these: upload_max_filesize post_max_size max_input_time max_execution_time memory_limit Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 19, 2007 Author Share Posted July 19, 2007 okay i will! I get this error message after the file has uploaded: Connected as test@test.com White River Outdoors Business Card.jpg image/jpeg 338120 /tmp/phpyCWAfm 0 successfully uploaded /tmp/phpyCWAfm Quote Link to comment Share on other sites More sharing options...
Carterhost Posted July 19, 2007 Share Posted July 19, 2007 I would probably use FTP_BINARY as the mode, unless the only thing you're uploading is Text files. Text files can be uploaded in binary mode no problem. Binary files (including JPGs) will not transfer correctly in FTP-ASCII Mode. Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 19, 2007 Author Share Posted July 19, 2007 thanks that worked Quote Link to comment Share on other sites More sharing options...
lutrella@gmail.com Posted July 20, 2007 Author Share Posted July 20, 2007 Is there anyway to add a staus bar or precentage stat, to let the user see the upload status? 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.