• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

PHP initiating an FTP protocol file upload?

Using PHP code, I wrote a program that will upload files to a webserver based on a browsed, local file reference.  If I upload a large file it can take 4 hours.  However, if I use an FTP client, it takes 10 minutes.  Now, I understand that FTP protocol is faster than PHP with forms, but is there a way, using PHP code to initiate and upload a file using an FTP protocol?  I want my PHP program to be as fast as an FTP client.

If it's possible-- does anyone have some sample code I could use?

thanks a ton

Normenclature
0
normenclature
Asked:
normenclature
  • 3
  • 2
  • 2
4 Solutions
 
walkerkeCommented:
I'm not sure I understand the question. Since PHP is a server-side scripting language, I must assume that you wrote a script that takes a file from an HTTP upload and stores the file on the web server. Again, since PHP is a server-side scripting language, it can only process what is presented to it by the visitor in the HTTP request. To my knowledge, it cannot process requests made by an FTP client. It also cannot initiate anything to happen on the client side using any protocol.
0
 
normenclatureAuthor Commented:
So, you're saying there is absolutely no way on the client side even (JavaScript?) to make an FTP protocol upload like an FTP client?
0
 
walkerkeCommented:
There may be some way in Javascript to initiate an FTP upload using their FTP client but I don't know how. Since Javascript is client side, it's possible. But not to perform an FTP upload using Javascript.

It is possible to use a Java applet which is downloaded to the client's browser to perform an FTP upload. I know this because I've seen one -- not because I know how to create one. That'd be a question for the Java forum.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hernst42Commented:
An upload via HTMl/Javascript is only possible if the user specifies the file via the file-input box. Else everyone could hijack your files with a prepared server. The only way would be to have an applet which acts like an ftp-client and the applet must be trusted by the user.
If there are such big time differences between ftp and http- upload there must be something inbetween which throttles the HTTP- upload. The http-upload shouldn't take more than 25% of the ftp-upload. If it takes more either there is a problem with the webserver or a proxy.
0
 
normenclatureAuthor Commented:
Are you saying that even with a 200 MB upload, if it takes an hour using FTP it should only take one hour and 15 minutes with an HTTP?

And if there is a problem with a proxy, what can be done about it?

n
0
 
hernst42Commented:
yup sending data via HTTP should not take much more bandwidth/time than sending it via ftp.

Detecting proxy/transparent proxies is very hard. You will need to check every point (if possible) where the IP-packages are trnasfered. Typical the network admin should know if there are proxies or the hosting company should tell you if there a any secuity measures which limit incoming traffic (e.g to prevent DOS-Attacks)
0
 
normenclatureAuthor Commented:
OK-- thanks for all your help!
n
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now