0

It opens the root folder, are you sure you have write permissions there? Perhaps you need to ftp_chdir to a different folder first.

0

It opens the root folder, are you sure you have write permissions there? Perhaps you need to ftp_chdir to a different folder first

Yes, theorically I should.

Its the root server to where I FTP with the user Im using all the time.

Should I chmod before it or something?

0

Besides, yes, I should; Remember the file is created but no content is inside.

0

Its visible, meaning I see the file; As a matter of fact, the server is next to me, I see it appear in the explorer but when I open it, it is empty when on the local side, it has text inside.

0

Im reading the documentation but I really dont see the problem..........must be something small....

0

Am out of ideas right now. When I'm home I can try your code.

Thank you, Ill see them tommorow.

0

Did some conditional ifs and all of them return true....

<?php



                $name=$_FILES['file']['name'];








                $conn_id =  ftp_connect("127.0.0.1");

                $login_result = ftp_login($conn_id, "user","pass"); 

                ftp_pasv($conn_id, true); 





                if (move_uploaded_file($_FILES["file"]["tmp_name"],getcwd()."/".$name))
                    {
                        echo ("work");


                    }
                    else
                    {
                        echo ("doesnt work");
                    }



                $fp = fopen(getcwd()."/".$name, "w");

                if ($fp==false)
                {
                    echo ("problem opening file");
                }



                echo ("hi");
                fclose($fp);



                if (ftp_put($conn_id, $name, getcwd()."/".$name, FTP_ASCII))
                {
                    echo ("working correctly");
                }
                else
                {
                    echo("problem");
                }


                exit;

BTW, this has worked in the past FTPing to this server so....

0

Also, transfering the file with Windows Explorer works so its not a permissions issue....

0

We overwork pritaeas....

$name=$_FILES['file']['name'];
$conn_id = ftp_connect("127.0.0.1");
$login_result = ftp_login($conn_id, "user","pass"); 
ftp_pasv($conn_id, true); 
$upload = ftp_put($conn_id, $name, $_FILES['file']['tmp_name'], FTP_ASCII); 
exit;

Done.

0

Odd..........ftp_put gives me a warning that it cant created the file.

Edited by riahc3

0

OK, a basic txt file created in Notepad gets transfered yet a text file created by Java doesnt.....

I hate this shit.

0

It gets weirder and weirder....

I had some simple text in the text file I created in Notepad. Lets say "The fox"

I am able to transfer that thru PHP and it creates the file with "The fox" inside

Now lets say a text file from Java says "The fox jumped over the fence". That doesnt transfer.

What I did is I copied that text from the Java one to the Notepad one and saved it. But when I transfer now the Notepad text file it just says "The fox jumped". Nothing else.

Why?

0

I can upload small texted file but not large ones....

Let me check for a limit...

0

Created by Java, is it perhaps a unicode file, or containing a BOM marker. If so, it maybe considered a binary file. Try FTP_BINARY, works on ascii files anyway.

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.