Ftp_put not uploading file size bigger than 1M

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ssaboo
Forum Newbie
Posts: 3
Joined: Wed Jan 14, 2004 1:06 pm

Ftp_put not uploading file size bigger than 1M

Post by ssaboo »

Am using following code to upload a file to ftp server.
----------------------------
$login = @ftp_login($conn, $ftpUser, $ftpPass) or die ("Login details failed !");
$putFile = @ftp_put($conn, $_FILES[file1][name],$_FILES[file1][tmp_name], FTP_BINARY);
----------------------------
Ftp works fine for smaller file size but errors out on file size bigger than 800K. I get this error:
The POST method does not allow the data transmitted, or the data volume exceeds the capacity limit

I checked php.ini and these settings seems ok .
post_max_size = 8M
upload_max_filesize = 50M

Can somebody tell me what is wrong? Thanks in advance for your time.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What does the HTML for the upload form look like - are you limiting file size in that? Does the error message give any information as to where it is coming from, e.g. browser or webserver.

Mac

P.S. Definitely have a read of the second link in my signature - "Why is $foo[bar] wrong".
ssaboo
Forum Newbie
Posts: 3
Joined: Wed Jan 14, 2004 1:06 pm

Post by ssaboo »

Thanks for your reply.
The html code is like this...(no file size specified)
----------------------------------------
<BODY>
<form method="post" action="do_uploadFTP.php"; enctype="multipart/form-data">
<p><strong>File to Upload:</strong><br>
<input type="file" name="file1" size=40></p>
<p><input type="submit" name="submit" value="Upload File"></p>
#echo phpinfo() ;
</BODY>
----------------------------------------

Apperently, it is a server error. I see this in Apache error log:
------------------------------
[Thu Jan 15 13:54:34 2004] [error] [client 66.207.130.10] Requested content-length of 1270730 is larger than the configured limit of 524288.
------------------------
What settings should be changed and where? We are using Plesk (which uses Apache) for managing web sites.

Thanks a lot.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Definitely sounds like Apache has been configured to not accept file uploads bigger than 512kB. Depending how much control you have over your Apache installation (you may find it easier to speak directly with your host) this is the directive you'd probably need to adjust:
http://httpd.apache.org/docs/mod/core.h ... equestbody

Mac
ssaboo
Forum Newbie
Posts: 3
Joined: Wed Jan 14, 2004 1:06 pm

Post by ssaboo »

Thanks for pointing me out to right direction.
First, I could not find LimitRequestBody directive in httpd.conf file. Upon doing further searching, I found this directive in php.conf.

I changed the LimitRequestBody and now I can upload files of larger size.

Thanks a lot "twigletmac". Greatly appreciate your timely help.

- Happy user of this forum :)
Post Reply