Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php FTP upload with progress bar

Posted on 2009-04-07
11
Medium Priority
?
5,364 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 35

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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 35

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
 
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 35

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 35

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 2000 total points
ID: 25162431
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
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…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

886 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