If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

$file is a string. It needs to be a resource. Run the file through an fopen and provide the third argument with that file resource. The variable names may be incorrect though; you are running a put call, but you are calling the file you are uploading as $file and the remote name will be $local_file. These seem backwards to me.

If you still have issues, try running a ftp_pasv($sessid, true); first to run in passive mode.

$file is a string. It needs to be a resource. Run the file through an fopen and provide the third argument with that file resource. The variable names may be incorrect though; you are running a put call, but you are calling the file you are uploading as $file and the remote name will be $local_file. These seem backwards to me.

If you still have issues, try running a ftp_pasv($sessid, true); first to run in passive mode.

I tried that but if I do that I get:

Warning: ftp_put() expects parameter 3 to be string, resource given

And yea, the names are a bit backwards, I had taken this script from one that originally used the ftp_get function, but I just changed it to put instead.

Oh yeah my bad you're right. I was thinking of ftp_fput, not ftp_put.
Open the passive mode. I'm not that familiar with the possible errors from the ftp. This is definitely bizarre looking to me (it looks like it successfully did nothing :/).
Make sure your filepath is valid as well for the local file. You can check that using file_exists. It'll need to be readable as well. Pull a list of the ftp_nlist as well to see if the directory for the file you want to upload is available. The documentation doesn't specify, but I don't think FTP allows you to create a directory implicitly with an upload.

Oh yeah my bad you're right. I was thinking of ftp_fput, not ftp_put.
Open the passive mode. I'm not that familiar with the possible errors from the ftp. This is definitely bizarre looking to me (it looks like it successfully did nothing :/).
Make sure your filepath is valid as well for the local file. You can check that using file_exists. It'll need to be readable as well. Pull a list of the ftp_nlist as well to see if the directory for the file you want to upload is available. The documentation doesn't specify, but I don't think FTP allows you to create a directory implicitly with an upload.

What's the difference between fput and put? I think all the paths are correct because it successfully creates the file in the right directory, the problem is the file is empty :\ Tried the passive mode and same issue, warning message and just puts an empty file there.

I believe it will always attempt to create the file and then take the data within the source to copy. If the source isn't valid, it would result in an empty file.
fput is using an open file, put is using a filename. I would use the fput since you can verify with 100% certainty that the file is readable after opening before moving it to the server.