Jump to content

ftp_put chokes on large file


heritage1
Go to solution Solved by heritage1,

Recommended Posts

ftp_put() has worked for several years.  Recently it would not upload a 3 MB pdf file.  When I cut it down to 1 MB, it worked fine.

The error message is rather cryptic; "File name can not be empty".  Note:  3 MB file chokes.  File with pages deleted until it is 1 MB with same name, uploads fine.  I tried set_time_limit(0); and ftp_pasv($con,TRUE);  but this does not help.  (Both inserted after login.)  I did not include code segment since is very straightforward and has worked for at least three years in a Content Management System with a variety of users.

 

Any suggestions?  Does ftp_put() have any other restrictions beside timeout?

Link to comment
Share on other sites

Did the code you had worked and just stoped working for an unknown reason? Or is it "new code"? Or did you change your server or some other configurations?

 

The only thing I can think of is checking the upload file limit in your php.ini if you're uploading the file to your server before "ftp uploading" it elsewhere. If you do upload a file to your server before "ftp-ing" it and there is an error, the filename will be empty.

Link to comment
Share on other sites

  • Solution

Oops.  My bad.  Forgot to check back in.  You are exactly right.

 

My host runs Apache 2.2.3 and has a default size limit on files transferred by ftp_put().  I thought the problem was time but it was actually file size.  My solution was to add this line to php.ini

 

upload_max_filesize = 8M

 

Thanks for the comments

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.