I have an application where I am prompting for a client side file with a "browse" button command within my html script. Once this information is entered I have a submit button to call my php script to perform an ftp_put to my server.

After some investigation it appears that when the "submit" button is pressed the file information from the "browse" input is stored to a tmp directory on the server, and a simple COPY command within php will store the file where I would like.

The problem is that I am trying to send the file to the server via FPT not HTTP, which appears to be what is happening once "submit" is entered.

Can anyone verify my findings, and if so, what would be the best approach to obtain my client side file information for ftp upload using php?

Any help is greatly appreciated.

skypilot

    Originally posted by skypilot
    Can anyone verify my findings, and if so, what would be the best approach to obtain my client side file information for ftp upload using php?

    Any help is greatly appreciated.

    skypilot

    1. Yes.

    1. If you want to do an FTP transfer, why are you using an HTML client as the interface?

    And, just out of curiosity, why is ftp preferable?

    Finally, why [man]copy/man when you can [man]move_uploaded_file/man ?

      1)

      HTML Client is being used because of the nature of the application, and I assumed this was the only way to obtain client side information from my server side application.

      2)

      I have been told that ftp is the best solution for speed, security and data integrity verses copy or move_uploaded_file which I am ASSUMING are http protocal based? If this is a wrong, please let me know.

      3)

      I am assuming also that your answer of "yes" is to indicate that the html prompt for file input and a submit buttom, DO result in an http copy of the file to the server side from client side. Please verify.

        As for the interface, I'm simply observing that using a browser (which is an HTML interpreter) to interface with FTP (which is not the hypertext protocol) seems weird*. An FTP client for FTP transfers, a browser for HTTP.

        As for security, neither protocol (FTP/HTTP) could be rightly called secure. As for integrity, FTP may have a slight advantage. Speed? For most people, irrelevant; the speed of the downlink is the limiting factor, and firewalls these days occasionally create issues with multi-port passive FTP transfers, so it seems to me. It could be that this isn't an issue in your situation, of course.

        Assuming that you put together a form with enctype="multipart form/data", a file "browse" input (type=file), etc., submitting the form will transfer the file to the HTTP server via HTTP POST, yes. This is what you discovered; I merely confirmed it.

        To get back to your original question; PHP could serve as an FTP server, but I don't see how it will help on the client side, as it's not a client side technology... in order to do an FTP "put" from the client, something on the client's machine will have to do some work....

        *granted, it's done all the time, since (Microsoft was first?) browsers added FTP capability. But I don't think there are any JS functions to do this automagically???

          Write a Reply...