473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ftp always puts 1kb file on server

this script used to upload files to the server without any issue:

$oFTPConn = ftp_connect($sFtpServer,21,600) or die("Unable to connect ot
$sFTPServer!"); //login to the ftp server and upload the file //
$iFtpTimeOut = ftp_set_option($oFTPConn, FTP_TIMEOUT_SEC, 600);
$cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
$cmdUpload = ftp_put($oFTPConn, $sFullDestinationPath, $_POST['srcFile'],
FTP_BINARY);
if ($cmdUpload != FTP_FINISHED){
echo("There was an error uploading the file...");
}
$cmdCloseFTP = ftp_close($oFTPConn);

since the host company upgraded to php5, it appears to upload the files, but
they're always 1kb large? any idea what's going wrong?

Jul 17 '05 #1
4 2915
On Thu, 25 Nov 2004 09:55:03 -0500, "Nancy Drew" <ge*****@hotmail.com> wrote:
this script used to upload files to the server without any issue:

$oFTPConn = ftp_connect($sFtpServer,21,600) or die("Unable to connect ot
$sFTPServer!"); //login to the ftp server and upload the file //
$iFtpTimeOut = ftp_set_option($oFTPConn, FTP_TIMEOUT_SEC, 600);
$cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
$cmdUpload = ftp_put($oFTPConn, $sFullDestinationPath, $_POST['srcFile'],
FTP_BINARY);
if ($cmdUpload != FTP_FINISHED){
echo("There was an error uploading the file...");
}
$cmdCloseFTP = ftp_close($oFTPConn);

since the host company upgraded to php5, it appears to upload the files, but
they're always 1kb large? any idea what's going wrong?


How big were you expecting them to be?

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:ms********************************@4ax.com...
On Thu, 25 Nov 2004 09:55:03 -0500, "Nancy Drew" <ge*****@hotmail.com> wrote:
this script used to upload files to the server without any issue:

$oFTPConn = ftp_connect($sFtpServer,21,600) or die("Unable to connect ot
$sFTPServer!"); //login to the ftp server and upload the file //
$iFtpTimeOut = ftp_set_option($oFTPConn, FTP_TIMEOUT_SEC, 600);
$cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
$cmdUpload = ftp_put($oFTPConn, $sFullDestinationPath, $_POST['srcFile'],FTP_BINARY);
if ($cmdUpload != FTP_FINISHED){
echo("There was an error uploading the file...");
}
$cmdCloseFTP = ftp_close($oFTPConn);

since the host company upgraded to php5, it appears to upload the files, butthey're always 1kb large? any idea what's going wrong?
How big were you expecting them to be?


anywhere from 5kb to about 150 kb

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

Jul 17 '05 #3
"Nancy Drew" <ge*****@hotmail.com> wrote in message news:<jd********************@rogers.com>...
this script used to upload files to the server without any issue:

$oFTPConn = ftp_connect($sFtpServer,21,600) or die("Unable to connect ot
$sFTPServer!"); //login to the ftp server and upload the file //
$iFtpTimeOut = ftp_set_option($oFTPConn, FTP_TIMEOUT_SEC, 600);
$cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
$cmdUpload = ftp_put($oFTPConn, $sFullDestinationPath, $_POST['srcFile'],
FTP_BINARY);
if ($cmdUpload != FTP_FINISHED){
echo("There was an error uploading the file...");
}
$cmdCloseFTP = ftp_close($oFTPConn);

since the host company upgraded to php5, it appears to upload the files, but
they're always 1kb large? any idea what's going wrong?


By 'host company' do you mean the server you are sending -to- or the
one you are sending -from-?

Have you verified that the files uploaded really are 1K, or perhaps
you are getting a quirky directory reading?

Interesting problem!
Jul 17 '05 #4
"Nancy Drew" <ge*****@hotmail.com> wrote in message news:<jd********************@rogers.com>...
this script used to upload files to the server without any issue:

$oFTPConn = ftp_connect($sFtpServer,21,600) or die("Unable to connect ot
$sFTPServer!"); //login to the ftp server and upload the file //
$iFtpTimeOut = ftp_set_option($oFTPConn, FTP_TIMEOUT_SEC, 600);
$cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
$cmdUpload = ftp_put($oFTPConn, $sFullDestinationPath, $_POST['srcFile'],
FTP_BINARY);
if ($cmdUpload != FTP_FINISHED){
echo("There was an error uploading the file...");
}
$cmdCloseFTP = ftp_close($oFTPConn);

since the host company upgraded to php5, it appears to upload the files, but
they're always 1kb large? any idea what's going wrong?


Possibly you need to use this function:
http://www.php.net/manual/en/function.ftp-alloc.php

What type of OS on the server(s) are you loading to/from?
Jul 17 '05 #5

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

Similar topics

1
by: balzano_1 | last post by:
Hi, im trying to upload a file from a client (windows) to an ftp server (linux), i deciede to use some of php`s functions to connect and authenticate etc.. i only wish to put a file on the server,...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
2
by: valerio | last post by:
Hi all, I've some problem to import data to DB2 using the db2move and db2look tools. Follow the problem : I have exported data from db2 v. 7 database on windows server, using the db2look and...
12
by: Phoe6 | last post by:
The Program Fragment is this: int choice; /* Users Input Command */ .. .. .. printf("Enter a command: "); fflush(stdin); choice = getc(stdin); printf("\n");
36
by: Debaser | last post by:
I've recently read in one of my old C books that puts() is a better function call with regard to performance than printf() in the following situation: puts("Some random text"); vs. ...
4
by: Rodo | last post by:
Hi all, I'm new to this whole thing. I have a bunch of text files that are created by a software at work that keeps info one of our products. Each unit being calibrated gets a "record" (track by...
9
by: anon.asdf | last post by:
In terms of efficieny: Is it better to use multiple putchar()'s after one another as one gets to new char's OR is it better to collect the characters to a char-array first, and then use...
16
by: Jonathan Wood | last post by:
Greetings, I was wondering if anyone here has a good understaning of the Session object. I know there are options like the Session.Abandon method and the regenerateExpiredSessionId setting,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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
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...

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.