Solved

php FTP upload with progress bar

Posted on 2009-04-07
11
4,948 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…

864 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

20 Experts available now in Live!

Get 1:1 Help Now