473,503 Members | 11,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FTPing a zip file

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
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="10000">
<input type="file" name="userfile"> <br>
<input type="submit" name="Upload File" value="Upload File">
</FORM>
//ftp_upload.php
// 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
$ftp_user_name";
exit;
}
else
{
echo "Connected to ".$ftp_server.", for user ".
$ftp_user_name."<br>";
}

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

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

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

// close the FTP stream
ftp_quit($conn_id);

?>
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
0 1444

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3910
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
5433
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
7
3515
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
2
1334
by: Rakshas | last post by:
Looking for a solution where I can have a desktop app that updates the mdb file on my server automatically without having to FTP the table. Even better would be some kind of a web form that does...
3
26239
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
13
4281
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
5352
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
2
1125
by: Jay | last post by:
Hi, I have created FTP class file in c#.net. When i try to access FTP server (on Windows XP) through command line or browser, i am easily able to access it. but when i try it through my code, i...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.