Solved

php FTP upload with progress bar

Posted on 2009-04-07
11
4,909 Views
Last Modified: 2013-11-29
Greetings.
Does anyone know how to create an AJAX FTP upload bar with PHP?

I would like to upload large files (100meg or bigger) using PHP's FTP libraries....
but I want to track the progress....
Help?
0
Comment
Question by:Evan Cutler
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 24093370
The only one that I've seen that works pretty well is the uploader that comes with WordPress - you may want to download that and look at its code.

On another note, if you're using AJAX, then I'm assuming that you're uploading from a browser. If that's the case, then the file is first uploaded via HTTP before being transferred with FTP. One word of advice: uploading large files with a web browser doesn't usually work very well.

If you're dealing with a couple of megabytes, that is one thing, but I usually see uploads over 10-20 megabytes fail. The browsers time out or just stop transferring, and there is no good way to resume an upload with HTTP. That means if you're uploading a 100 megabyte file and it fails at 99 megabytes, you have to start all over again (and most of us have slow upload speeds).

Using a regular FTP client is far more reliable (SFTP if you can, since FTP is insecure). Most people have FTP clients that support SFTP, and if they don't, there are a lot of them for free (FileZilla for example).

0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 24093374
Thanks but I don't have the choice.
I need to upload via ftp, and use the browser.
Maybe Java?
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24093512
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 24103183
Java (not Javascript) would probably be a better choice for upload large files. It's a little clunky - personally I try to never use Java, but it should be more reliable than trying to go through the browser's built-in capabilities.

Also - when you say that you don't have a choice, can I ask why?

If it's related to some sort of hosting restriction, you may also want to see if you have the ability to define the maximum upload size - many hosts don't let you upload more than10 megabytes per form post (sometimes less than that). It's a setting in the php.ini file and some hosts don't allow you to change it via the ini_set() function. If that's the case, then PHP won't work for you.
0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 24103430
The thought here is that the customer wants to lock down the procedures.
Doesn't want an FTP client.  Want's a "browse" and "upload" click that can handle the size.

Java was the original thought.  I'm open to any solution if PHP, javascript, html, or Java

Thanks
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 28

Expert Comment

by:lesouef
ID: 24175253
how about this http://pagetruck.com ?
this is a customized version of an open source stuff, let me know if you wanna know more about it.
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 24175419
I thought this question had been closed - oops.

As  I mentioned before, I'm not a fan of Java applets, but they're probably better suited for this. Googling for java applet upload gives good results - the first two are JUpload (open-source) and a nicer-looking uploader that needs purchasing:

http://www.javaatwork.com/java-upload-applet/demo.html
0
 
LVL 28

Expert Comment

by:lesouef
ID: 24175547
my solution uses none, pure http file upload... if it must be installed in strict sites where java is prohibited (administrations sometimes, etc...)
if you're on your way for java applets, see thinupload.com  (same guy as radinks) , one of the best for me.
I have some more links on my other PC if you're interested.
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 24177023
lesouef - I was just suggesting java applet because of the intended sizes of the files being uploaded (he mentioned 100 megabyte files, and large http uploads are prone to failure).
0
 
LVL 28

Expert Comment

by:lesouef
ID: 24178262
I do these currently. Unless your internet connection is on a boat, that fails rarely and my server is setup to accept 256MB.
And if the java applet is better it's because it has a resume feature, and therefore doesn't use the regular file upload of a web server which has no resume feature unfortunately. So an applet will be better if it has a specific server part to receive files or uses ftp to a ftp server which has a resume feature. But that is less standard and can't be implemented everywhere. So it really depends if you are intending the app to be used by a specific audience or a large audience. Applets will be forbidden by a lot of companies since they break quite a few internet safety rules like being able to write to the local disk.
0
 
LVL 14

Accepted Solution

by:
profya earned 500 total points
ID: 25162431
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Please see preceding article here: http://www.experts-exchange.com/Networking/Operating_Systems/A_11209-Root-Bridge-Election.html Figure 1 After Root Bridge has been elected, then what?..... Let's start by defining a Root Port in la…
The viewer will learn how to count occurrences of each item in an array.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now