By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

FTPing a zip file

P: n/a
I am trying to write a small web interface to allow users to upload a
zip file to our server. Below is code:
//The form
<FORM action="ftp_upload.php" method=post
<input type="hidden" name="MAX_FILE_SIZE" value="10000">
<input type="file" name="userfile"> <br>
<input type="submit" name="Upload File" value="Upload File">
// set up basic connection
$conn_id = ftp_connect(serverinfo);

// login with username and password
$login_result = ftp_login($conn_id, username, password);

// check connection
if ((!$conn_id) || (!$login_result))
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
echo "Connected to ".$ftp_server.", for user ".

$source_file = $_FILES['userfile']['tmp_name'];

// upload the file
$upload = ftp_put($conn_id, $somedir.$userfile_name, $source_file,

// check upload status
if (!$upload)
echo "<br>FTP upload has failed!";
echo "<br>Uploaded $source_file to $ftp_server as

// close the FTP stream

All of this works fine except for a .zip file in which case I get the
following message:

Warning: error opening none in ftp_upload.php on line 72

This is the ftp_put line.

Any help would be greatly appreciated .......
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.