We are developing a video file upload feature in a php website. We need to upload files upto at least 100MB. We are using some flash upload tools which shows progress bars.
When we try, even 10 MB files are itself taking lot of time and progress bar seem to end very fast and we have to wait long time to finish uploading. Is there any good progress bar plugins for large file uploads
Also can we use any other file upload methods other than http upload?
Is it possible to upload file using FTP for video file uploads. I have seen a few samples but nothing seem to working..
There are several options, if you wish to go down the PHP route then take a look http://www.sitepoint.com/upload-large-files-in-php/.
else, you can try the JAVA applet route and a good place to start would be with http://jupload.sourceforge.net/
I think in this case i would use the Java Applet.
FTP can be more tricky for the user than a plain html upload form, but would be the preferred way to upload in my opinion (robust protocol, resume support etc.)
For a nice html upload form, you could have a look at plupload, which offers a wide variety of options for client side plugins. It supports graceful degradation, and in the case of html5 file uploads support, it also supports chunking the upload.
Related
Is there any way to upload large files (more than 80 Gb) through a web browser? Previously I have been uploading files (img, png, jpg) using plupload but it seems not to be working for larger files. I would also like to know how to implement a web page where users could upload like Mega.co.nz or Drive.google.com.
If it is impossible to do it using web development tools, can anyone guide me about how I can divide & upload a file in segments?
Thanks.
You can use the JavaScript Blob object to slice large files into smaller chunks and transfer these to the server to be merged together. This has the added benefit of being able to pause/resume downloads and indicate progress.
If you don't fancy doing it yourself there are existing solutions that use this approach. One example is HTML5 Uploader by Filkor.
If I was you I would use something like FTP to accomplish this. If you can use ASP.NET there are already good libraries that exist for file transfer.
Here is a post that shows an example of uploading a file: Upload file to ftp using c#
The catch is you will need a server. I suggest Filezilla. https://filezilla-project.org/
I'm trying to figure out if there's a way to get the progress of a file upload with PHP and/or Kohana. My script can upload images, videos, zip, exe, whatever I want really. However the larger the file the longer the user has to wait without any indication.
I was hoping to use some AJAX here to initialise the upload and then report back the progress.
Is this possible with PHP... and can anyone give me an indication of where to start looking.
there is a file upload progress extension for php, see http://www.ultramegatech.com/blog/2010/10/create-an-upload-progress-bar-with-php-and-jquery/ for how to use it.
I like to use a server module to do this sort of thing, mainly because it makes my life as a web developer easier if all I need to do is grab upload statistics from a URL. Nothing has to be changed in your website.
For Nginx there is the Upload Progress module and it should work on all recent releases. You can find code examples on the Nginx Wiki: http://wiki.nginx.org/HttpUploadProgressModule
For Apache there is the Upload Progress too. I haven't used it myself, but it seems fairly straight forward.
If you don't have access to the server configuration, then you might want to fall back onto a pure flash / javascript solution. For this I had good luck with Uploadify in the past, but it requires a bit more work as you now have to upload files in a separate request. Someone should be able to suggest a good HTML5 upload progress plugin too.
you could do this also with apache and APC example
When the user selects a file to be uploaded, is there a way I can get the exact size of this file before the upload even begins? I'm guessing this needs to be done on the client side with jQuery or JavaScript. Any ideas how?
This cannot be done in pure Javascript in current browsers.
Instead, you can use Uploadify, which uses Flash.
In non-IE browsers, you can also use HTML5 to read files on the client.
$("#file_input_selector").bind('change', function(){
alert(this.files[0].size);
});
Not sure of all the compatibility issues, but this seems to be working just fine for me.
Take a look at this post:
http://forums.digitalpoint.com/showthread.php?t=6704
Javascript doesn't have the ability to check file sizes (or access the file system for that matter). You'll need to upload the file to get the size
I suggest you look at the HTML5 File API. This, combined with some JS might be able to help you. I only say might because I have not yet had a chance to browse at this part of the HTML5 standard.
http://www.w3.org/TR/FileAPI/#dfn-filereader
The way PHP file uploads work, it is very hard to check file details before, or during a file upload (since the file is uploaded before your code even gets loaded).
I know it is possible to do some fancy things in some other languages (possibly Perl or Python) that handle the file uploading directly with the script (where the script opens the socket and handles the whole transfer itself), however PHP does this for you and accepts any file on your script's behalf. The file gets discarded if it is not within PHP's acceptable limits, but only after the file is completely uploaded.
There have also been several file upload implementations made using Flash, but not being an ActionScript coder, I can't really help too much there either.
How to show progress bar in PHP where i have to upload the file size of of 100MB? I cannot have APC installed. I am allowed to do so..
Help me out to get it done...
P.S > I DO NOT HAVE DEDICATED SERVER HENCE CANNOT USE APC
We have PHP 5.2+
the most suitable one for is uploadify
its simple & powerful jquery plugin and it can support queuing ,
i had test it before writing this answer with out APC
it had successfully upload 500 MB , its very handy tool
for me the best choice is SWFupload...
check this demo: http://demo.swfupload.org/v250beta3/formsdemo/index.php
just fill the form attach a file and click send... you will see how progress bar are approaching.
you don't need any server side scripts, besides the one to handle incoming file.
The best approach for uploading large files that I've seen yet is to use PLUpload. It supports file chunnking (using Flash, Gears, Silverlight or Browser Plus) which will also allow you to keep your PHP file upload limits set lower.
Plupload v1.2.3
Allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms, providing some unique features such as upload progress, image resizing and chunked uploads.
APC is really the best (read: only) choice you're going to get without recompiling PHP and using unsupported third-party patches.
Have you considered using a client-side plugin to perform the upload status information? There's Plupload, for example, which will pick from a variety of plugins that the user may have.
Why are you "not allowed" APC?
I'd like to have my PHP script upload a file with a certain filename in a directory of my choosing. However, the catch is that I need it to exist there immediately upon upload so I can moniter it on my server. I don't want to use a PHP extension or something - this should be very easy to transfer to any PHP setup.
So basically: Is there a way to guarantee that, from the very beginning of the file upload process, the file has a certain name and location on the server?
Not that I'm aware of.
PHP will use the php.ini-defined tmp folder to store uploads until you copy them to their correct location with move_uploaded_file(). So it's very easy to know its location, but the file name is random and I don't think you can define it.
If you're not going to have multiple concurrent uploads (for example if only you are going to upload files and you know you won't upload 2 files at the same time), you could check the most recent upload file in the tmp directory.
The common solution for monitoring uploads is apc.rfc1867
I know of three options:
RFC1867 (as mentioned by others) which allows you to poll upload progress using ajax
Flash-based uploaders like SWFUpload which allow you to poll upload progress using JavaScript
Create a PHP command line daemon listening on port 80 that accepts file uploads, and used shared memory (or some other mechanism) to communicate upload progress. Wish I could find the link, but I read a great article about a site that allowed users to upload their iTunes library XML file, and it was processed live by the server as it was being uploaded. Very cool, but obviously more involved than the previous options.
I have had decent luck with SWFUpload in the past.
I don't think you can configure the name, as it will be a random name in the temporary folder. You should be able to change the directory, but I can't seem to find the answer on Google (check out php.ini).
As far as I know, this isn't possible with PHP, as a file upload request submits the entire file to the system in one request. So there is no way for the PHP server to know what is happening until it receives the whole request.
There is not a way to monitor file upload progress using PHP only, as PHP does not dispatch progress events during the upload. This is possible to do using a Flash uploader even if Flash is uploading via a PHP script. Flash polls the temporary file on the server during the upload to dispatch progress events. Some of the javascript frameworks like YUI use a SWF to manage uploads. Check out YUI's Uploader widget.
http://developer.yahoo.com/yui/uploader/