Most reliable method for uploading files in PHP w/ progress bar - php

I am interested in finding the most reliable method for uploading files in PHP. I need a progress bar with the upload.
I have tried SWFUpload but it randomly issues an I/O Error. Even if the same file is uploaded sometimes there is an error and sometimes there is not. I have configured all the necessary INI/Mysql/Apache directives to accept large file uploads.
So, I am looking for alternatives as a Flash based solution has not worked. Would Java be more reliable? I have also looked into PHP with APC.
I definitely cannot afford these random errors, so any help on reliable software / suggestions on how to minimize them would be appreciated.
Thank you.

There are other flash based solutions other than SWFupload. Have a look at uploadify.com

I haven't come around to try this myself yet but http://www.plupload.com/ might be what you're looking for on. But otherwise PHP + APC works good as well.

I am assuming 2 things here:
1) Some kind of client will be doing the file upload
2) You get some kind of say on what the client installs on their computer to help make this happen.
If this is the case, my first suggestion would be:
Give them FTP or SFTP client software to upload files. The php page you make can have a link to Filezilla, along with instructions on how to use it. ftp and sftp are THE protocols to use for transferring files. HTTP is just not designed(well) for it, nor are browsers.

Related

php, own little file manager instead of FTP. Good idea?

Im planning to add file manager (very basic once) because I never used FTP functions, and it looks easier (FTP connection loses when scripts is done). I would simply use POST request (or what should I?) instead of FTP functions. Is it good idea? Anyone knows restrictions?
As far as I can see only FTP functions are to post and receive files.
What you need to do is add dynamic form where you can select multiple files and upload them to specific directory of your chose.
You will need to get all available directories and files in them, probably with some kind of recursive function. More optimal way is to get directories/files of current folder and when you click on folder it will get files/folder for it.
Can it be done - sure. Is it a good idea - no. People will have access for uploading malicious files, we are not talking about images here, php scripts, shell scripts, executable viruses and so on...
If you are doing this only for yourself, for file posting and receiving I suggest you to use FTP clients for that.
I wouldn't recommend it, but it's probably best to use a 3rd party tool, rather than to write your own.
PHP File Manager
PHPfileNavigator2
FileManager
...
Keep in mind that both PHP and your webserver can put certain restrictions on the size of files that you can transfer, it is of course possible to change these in the configuration files.

Requesting advice for accepting large file uploads

I'm looking at building a web app that includes a file upload element. I'd like users to be able to upload files of any type and of fairly large size (say, up to 100MB). This will be a publicly accessible site, so security is obviously very important.
I've done a decent amount of googling in search of answers, but it's difficult when I don't really know exactly what I'm searching for.
My experience is mainly with PHP, but I realise that PHP is not considered to be the best when it comes to file uploading, so I'm happy to look at other languages if necessary. Although, if a decent solution using PHP can be acheived, that would be preferable.
As I have no experience with this kind of project, I'm also fairly in the dark on what kind of server setup is required for such an app.
I have braistormed a few ideas, but am willing to budge on them if unreasonable:
I'd like to use Amazon S3 to store the files if possible (to reduce the load on the server)
I'd like to be able to rename the files after upload
I'm considering Uploadify (uploadify.com) for the client side
Basically, imagine I was looking to build a file-sending app like wetransfer.com or yousendit.com and you'll get the general idea.
I'm familiar with all the usual PHP file upload issues (checking mime-types, upload_max_filesize, memory_limit, etc, etc) covered by 99% of posts on the internet on this topic, but obviously this project goes a fair bit beyond your average, run-of-the-mill avatar upload script.
I know this is a massive topic and I'm obviously not expecting anyone to present me with a magic solution, but basically I'm looking for some pointers on where to start. Can anyone recommend any good books, articles or websites where I can gain a better understanding of the requirements of the task? Covering everything from the programming to the server requirements? Even if it's just a list of keywords or phrases that I should be googling.
Thanks in advance!
P.S. I wasn't 100% sure if this was the right StackExchange site to post this question on. I also considered serverfault.com and webmasters.stackexchange.com. If you think this question would be better asked elsewhere, please let me know.
If you funnel the upload through your PHP you need to make sure that it accepts those large files. Especially upload_max_filesize, post_max_size and max_input_time. See POST method uploads for a general how to.
With Resumable.js you could circumvent above limitations quite nicely. It uploads small chunks of your 100MB at a time. This allows it to keep track of what's been uploaded to allow pause/resuming uploads.
While I've never worked with Amazon S3, I do not believe you can upload data from any client - at least not without some sort of authentication. You'll probably have to funnel the upload through your own server in order to push it to S3.

Multiple HTTP File Uploads

I'm looking for a tool to facilitate mulitple webpage file uploads from a single file browse dialogue. I know this has been asked previously, but I can't find anything current.
I'd like to check file size prior to upload, and I gather Flash is still the only way to do that cross-browser?
Ideally, I'd like an upload progress metre. I'll be using Linux and Apache servers, but don't have access to install add-ons such as PHP APC. Again, I assume something flash-based is the only option there?
I've looked at SWFUpload, but that appears to be another of these projects where the developers have become quite zealous and turned a simple concept into a full suite of tools for the masses. It seems quite cumbersome and I don't think I want to use it for my purpose.
I'd prefer not to have to write something from scratch for this. Could someone recommend me something or perhaps suggest a non-Flash alternative if there is one? I do need full cross-browser compatibility without too many layers of degradation, so anything HTML 5 probably isn't what I want.
Thanks
As I mentioned earlier today ( Multiple file upload (client side) )
I am a big fan of Plupload which can check file size, show progress bar, single dialog for multiple files, and supports things other than Flash if needed.

PHP / FTP Client

I'm about to get my hands dirty writing an FTP wrapper for PHP, I just need to perform the basics:
read / write and append to files
list / chmod and delete files / folders
Unfortunately I only had to mess with FTP within PHP once to answer this question, and I got somewhat disappointed with the ftp extension, mainly because it ain't trivial to distinguish between files and folders and the overall speed wasn't great.
As far as I know PHP has four distinct ways of interacting with FTP servers:
Pure Socket Implementation
File Wrappers
FTP Extension
CURL Extension
Now, I don't want to code the FTP client protocol myself, so option #1 is out of the equation.
File wrappers are great if I need to do something trivial like getting a single file, but they are extremely slow if I need to perform more complex operations since each call will open its own connection.
That leaves me with the FTP and CURL extensions, and here is where I need some guidance. As I said before I am not a big fan of the FTP extension, on the other hand I've never used CURL to FTP so I can't objectively compare one with the other.
Has anyone ever tried both approaches? What are your thoughts on them? Is the CURL option faster?
Also, are there any alternatives I'm not aware of?
Have you looked at the PEAR package Net_FTP?
I've tried both for one proj. Was needed to upload some file via ftps+auth connection with encryption and authentication then to get response code and XML info, kind of XML-RPC exchanging so at the end could not even come closer to the solution with php-ftp-extension and everything was accomplished with some debugging (CURLOPT_VERBOSE) and configuring with PHP-CURL. So I vote for CURL, it is from 1997-th and works great!

How might I obtain a Snapshot or Thumbnail of a web page using PHP?

I need to create Snapshots / Thumbshots / Site preview a-site.com.
There are some site as thumbshot.org that meets with I need. But I do not want to use an external service, not to depend on others for my project (What would happen if they close the site?)
For this reason, I am looking for some project to let me do this.
Any idea?
On windows you can use GD's imagegrabwindow() function.
Edit: The help page actually shows you how to grab a screenshot from IE.
There isn't anything in the PHP library to do this - you're looking at setting up an external application (with a queue) to take images, although you can of course use PHP to add items to the queue.
There are a couple of Windows functions in GD that takes screen shots of the computer (webserver - not the client) so perhaps you could write a script in PHP to do this.
Edit: Was thinking of these: imagegrabscreen and imagegrabwindow. I'm not sure they will do what you want however (even in full screen mode Firefox has ablue bar at the top of the screen - not sure about other browsers). However, Pierre has something on these functions if you're interested.
I'd suggest writing an application in another language (I assume .NET has something) to do this for you.
Edit: This page tells you how to do it in C#
There's not much PHP would do for you in this situation. You'd need a complete (X)HTML rendering engine with CSS-support, possibly also with JavaScript support.
That, or use some kind of kinky script that would launch a real browser, and take a screenshot out of that. Either way, PHP is probably not the right tool for the operational part.
There's a Firefox extension that converts the webpage you're viewing to an image:
http://www.screengrab.org/
http://addons.mozilla.org/en-US/firefox/addon/1146
If you're willing to get creative, it might be possible to access this problematically.
Thanks to all.
I found a pseudo-solution, (using dcom + imagegrabscreen + wamp).
I need to resize the final.png with gd, because the png is equal to resolution of client (in my home, is a picture of 1650*1280).
Whe I end this, I will post a .zip file to dowload
Thanks again
(But if anyone have a better idea, I am happy to see that)
PS: Sorry for my english

Categories