473,770 Members | 4,419 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($ft p_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_SHO RT_FILE_NAME;
$upload = ftp_put($conn_i d,
$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 3083
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_file size = 2M
-------->>END CODE<<--------

HTH
la***********@z ipmail.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*******@gmai l.com" <cl*******@gmai l.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_file size = 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.u k :: 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.comwrot e:
$upload = ftp_put($conn_i d,
$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.u k :: 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.comwrot e:
$upload = ftp_put($conn_i d,
$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.u k :: 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
15446
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 transfers eventually ....). At the moment I can test out sending a set of parameters to the server, and using mod_python, I have a python script which displays these values.
7
4536
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" ACTION="UploadAction.asp" METHOD="POST" enctype=multipart/form-data> <input type="file" name="fileName"> //etc ... </FORM>
1
2509
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- John
16
4987
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 set the POST limit in php.ini to 8 megs. What reasons, other than the POST limit, would a large upload fail?
0
4753
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 verdiği hata şu.Bilen arkadaşlar lütfen yardım edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. /classifieds/upload.asp, line 250
6
3337
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 upload it to a different web-server running RH 7.3 (an internal test-webserver), it works OK. The PDF document is created by OpenOffice 2.0 from a MS Word document. I have also had it converted to PDF in MS Word that could create PDF documents....
6
2273
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 Submitting dist\argparse-0.8.0.zip to http://www.python.org/pypi Server response (200): OK Submitting dist\argparse-0.8.0.win32.exe to http://www.python.org/pypi Upload failed (400): Bad Request
16
4511
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 overlooking? ******************************** $OpenQ = mysql_query("SELECT column FROM table WHERE q_uid = $_SESSION AND status = 1",$db); // SQL query on DB returns 1 result
1
2257
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 know why. However, if I try to upload the file without the semester field, the script is working. May be the problem comes from the semester field. This is my codes. Form.php ?><?php require_once('Connections/connection.php'); ?><?php if...
0
9602
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7431
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3987
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 we have to send another system
3
2832
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.