473,498 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is FTP upload failing?

Hi,

I'm using PHP 4.4.4 with Apahce 2.2 on Fedora Core 5 Linux. I'm having
trouble figuring out why an ftp_put call is failing. Is there a way I
can get an exact reason other than checking whether it has succeeded or
failed?

Here is my code

$conn_id = ftp_connect($ftp_host);
if ($conn_id) {
// login with username and password
$login_result = ftp_login($conn_id,
$ftp_user, $ftp_pwd);
if ($login_result) {
// Disable passive mode
ftp_pasv($conn_id, false);

// upload the file
$remote_path = "$ftp_dir/" .
SQL_PRODUCT_SHORT_FILE_NAME;
$upload = ftp_put($conn_id,
$remote_path, $sql_file_path, FTP_ASCII);

// check upload status
if (!$upload) {
die("FTP upload has
failed!");

I'm getting the message "FTP upload has failed" indicating things haev
died. Still don't know why.

Thanks, - Dave

Nov 13 '06 #1
6 3069
Usually the mistake I end up making is either related to permissions
(i.e. the permissions your webserver has to PHP's temporary directory)
or related to the file size limitations (as defined in the php.ini file).

I would start there. The php.ini file on Linux (and of course this is
not true for all ditros) is usually in /etc/php/ or /etc/php4

HTH
Nov 13 '06 #2
Thanks. What directives in php.ini am I looking for exactly? THe file
I was trying to FTP was a little over 1M, so I can see that being a
potential problem but not sure what the setting to adjust is.

- Dave

Joseph Dougherty wrote:
Usually the mistake I end up making is either related to permissions
(i.e. the permissions your webserver has to PHP's temporary directory)
or related to the file size limitations (as defined in the php.ini file).

I would start there. The php.ini file on Linux (and of course this is
not true for all ditros) is usually in /etc/php/ or /etc/php4

HTH
Nov 13 '06 #3
My php.ini file has an entire section dedicated to file uploads:

-------->>CODE<<--------
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system
default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
-------->>END CODE<<--------

HTH
la***********@zipmail.com wrote:
Thanks. What directives in php.ini am I looking for exactly? THe file
I was trying to FTP was a little over 1M, so I can see that being a
potential problem but not sure what the setting to adjust is.

- Dave

Joseph Dougherty wrote:
Usually the mistake I end up making is either related to permissions
(i.e. the permissions your webserver has to PHP's temporary directory)
or related to the file size limitations (as defined in the php.ini file).

I would start there. The php.ini file on Linux (and of course this is
not true for all ditros) is usually in /etc/php/ or /etc/php4

HTH
Nov 14 '06 #4
On 14 Nov 2006 15:28:58 -0800, "cl*******@gmail.com" <cl*******@gmail.com>
wrote:
>My php.ini file has an entire section dedicated to file uploads:

-------->>CODE<<--------
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system
default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
-------->>END CODE<<--------
That's for HTTP file uploads which PHP would receive and process from a client
- not FTP file uploads which PHP may initiate to another server, but wouldn't
typically process itself (you'd have to be running an FTP daemon written in PHP
which would be unusual).

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 14 '06 #5
On 13 Nov 2006 11:35:59 -0800, "la***********@zipmail.com"
<la***********@zipmail.comwrote:
$upload = ftp_put($conn_id,
$remote_path, $sql_file_path, FTP_ASCII);

// check upload status
if (!$upload) {
die("FTP upload has
failed!");

I'm getting the message "FTP upload has failed" indicating things haev
died. Still don't know why.
Do you have error_reporting cranked up to maximum and display_errors turned
on?

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 14 '06 #6
I do. In my php.ini file I have

error_reporting = E_ALL

and

display_errors = On

- Dave

Andy Hassall wrote:
On 13 Nov 2006 11:35:59 -0800, "la***********@zipmail.com"
<la***********@zipmail.comwrote:
$upload = ftp_put($conn_id,
$remote_path, $sql_file_path, FTP_ASCII);

// check upload status
if (!$upload) {
die("FTP upload has
failed!");

I'm getting the message "FTP upload has failed" indicating things haev
died. Still don't know why.

Do you have error_reporting cranked up to maximum and display_errors turned
on?

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 15 '06 #7

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

Similar topics

3
15424
by: alastair | last post by:
Hi, I'm attempting to test out some functionality of the Apache http server. What I'd like to do is send a file to the server - eg. a text file or binary file (I will be testing gzipped...
7
4520
by: Joe | last post by:
I have an upload file operation in the web application. UploadForm.asp is the form, and UploadAction.asp is the form processing. //UploadForm.asp <FORM NAME="InputForm"...
1
2490
by: John Thompson | last post by:
We're sooo close. When we load the page to upload the image, all of the prms go through except the binary image data. Using SQL server with the data type set to "image". Please help! Thanks-...
16
4944
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've...
0
4737
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
6
3314
by: =?ISO-8859-1?Q?J=F8rn?= Dahl-Stamnes | last post by:
I have a strange problem when uploading a PDF document to a web-server. When I try this to a web-server running Apache 2 on a FC 4, it fails. Firefox says that the document contain no data. If I...
6
2260
by: Steven Bethard | last post by:
I just tried to upload new versions of the argparse module to PyPI, but it seems like I can no longer upload Windows installers: $ setup.py sdist bdist_wininst upload ... running upload...
16
4478
by: Akhenaten | last post by:
I must be missing something rather obvious. I have the following snippet of code that echo's my result twice when it should be echoing just once (only one element in the array). What am I...
1
2238
by: ririe | last post by:
Hi. I have a problem here. I want to upload a file together with its semester. So I create two field. One for the semester and one for the file to be uploaded. But the script doesn't work. I don't...
0
7002
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
7205
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
6887
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
7379
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
5462
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,...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
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.