heritage1 Posted April 26, 2014 Share Posted April 26, 2014 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? Quote Link to comment Share on other sites More sharing options...
mogosselin Posted April 27, 2014 Share Posted April 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
Solution heritage1 Posted April 27, 2014 Author Solution Share Posted April 27, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.