 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Tracking Upload Progress with PHP and JavaScript
by Chris Cornutt February 06, 2012 @ 13:58:32
In a new tutorial today from PHPMaster.com, they show you how to combine Javascript and a PHP feature to track the progress of an upload to your web application.
A problem that has plagued web developers for years is how to add real-time information to their applications, such as a progress bar for file uploads. [...] JavaScript can access a file's name, type, and even the width and height of a local image, but it wasn't until HTML5 that it could access a file's size. [...] In this article I'll show you how [the session.upload_progress] feature can be used to create a simple upload progress bar without any external libraries or browser dependencies.
The tutorial provides all the steps you'll need to get it working - defining the form with the extra required field, styling it and plugging the Javascript in to call a small script to get the progress of the upload. It returns the difference between the content-length of the file and the current size (as a percentage of 100).
voice your opinion now!
track upload progress extension javascript tutorial progressbar
PHPMaster.com: File Uploads with PHP
by Chris Cornutt September 26, 2011 @ 11:42:40
SitePoint's PHPMaster.com site has a new tutorial today from Timothy Boronczky about handling file uploads in PHP. It's a pretty low-level introduction and is perfect for those new to PHP.
What do pictures in an online photo album, email attachments in a web-based mail client, and data files submitted to an online application for batch processing all have in common? They all rely on the ability to upload files across the Internet from the user's web browser. Indeed, uploading files is an important feature of many of the sites and web-based applications we use on a daily basis. In this post, I show you how to add support for file uploads to your site using PHP.
He starts with the changes you might need to make to your php.ini configuration file (for allowing uploads and setting a temporary directory) and a basic "form" tag with the necessary "enctype" setting. The sample form includes a "file" type field that submits the file data to a waiting PHP script on the backend. The script looks for the submit (in the $_FILES superglobal) and, after doing some filtering on the name and content type, moves it to a new directory.
voice your opinion now!
file upload tutorial introduction security contenttype filter
NetTuts.com: How to Upload Files with CodeIgniter and AJAX
by Chris Cornutt September 12, 2011 @ 12:03:27
New from NetTuts.com today there's a tutorial for those using the CodeIgniter framework for their application. It shows how to upload files with Ajax and a simple form (with jQuery and AjaxFileUpload).
Uploading files asnychronously can be a pain at the best of times, but when coupled with CodeIgniter, it can be a particularly frustrating experience. I finally found a way that not only works consistently, but keeps to the MVC pattern.
They help you create a database table to store the file information in (filename and title), make the controller to handle the request and build the view (with the form). Also included is the javascript you'll need to get the AjaxFileUpload script working for your file upload field. They extend the controller to handle the file upload and make a model to handle the upload and fetching of file information. The tutorial is finished off with a simple "delete" action to remove any file that's been uploaded.
voice your opinion now!
tutorial ajax upload codeigniter framework
DZone.com: PHP 5.4 features poll the results
by Chris Cornutt August 03, 2011 @ 08:19:43
On DZone.com today Giorgio Sironi has posted the results of a poll taken a little while back concerning what people thought was the best feature of the upcoming PHP 5.4 release.
After two weeks, we have closed the poll among the PHP community of Web Builder Zone to establish which are the most wanted features, which will influence development of applications on PHP 5.4. Hopefully this poll would also shape our focus in tutorials in the future - I personally plan to dedicate more time to the winning features.
Runners up included the removal of magic quotes and strict mode with the top three being (in this order) the upload progress patch, traits and the array improvements leading the pack. You can see the results here.
voice your opinion now!
poll results traits upload progress array improvement
NetTuts.com: Uploading Files with AJAX
by Chris Cornutt July 26, 2011 @ 13:19:43
NetTuts.com has a new tutorial posted showing you some of the basics of uploading files via Ajax a bit more natively.
I can't seem to reach the end of the fun stuff you can do with emerging web technologies. Today, I'm going to show you how to do something that-until the last while-has been almost unprecedented: uploading files via AJAX. Oh, sure, there have been hacks; but if you're like me, and feel dirty every time you type iframe, you're going to like this a lot.
Their method won't work in every browser, but it can be adapted to work as far back as IE6. The code and markup are included for each of the pieces for the example - the HTML for the upload form, the CSS to help style the resulting list of uploaded images, the simple PHP to handle the uploads and the jQuery-based code that implements the FileReader and FormData objects supported in newer browsers. The end result is a page like this that includes both the form and the list of uploaded images.
voice your opinion now!
upload file tutorial jquery javascript filereader formdata
QaFoo.com: Testing file uploads with PHP
by Chris Cornutt December 13, 2010 @ 13:53:24
On the QaFoo.com site Manuel Pichler has posted a new tutorial about using unit testing, specifically with PHPUnit (really ending up on phpt) to test and be sure that your file upload handling is working correctly.
A question I am asked on a regular basis is, how you can test a file upload with PHP. In this blog post, I take a precise look at this topic and show you how to test your file uploads from within your standard testing environment, using widely unknown testing framework for PHP.
He shows how to use a custom $_FILES superglobal to mimic the upload process noting, however, that this won't work due to possible file handling on the backend. His alternative is to use a phpt test to push a raw posted file to the application and then check the results. He then shows how to take these functioning tests and drop them back into PHPUnit via it's "PhpTestCase" handling. You can find full code examples here.
voice your opinion now!
testing unittest file upload phpunit phpt tutorial
Johannes Schluter's Blog: Upload Progress in PHP trunk
by Chris Cornutt December 06, 2010 @ 10:30:58
Johannes Schluter has a new post to his blog looking at the progress that the upload progress meter extension has been making and how a version of it, put together by Arnaud Le Blanc has been introduced to the trunk line of PHP's code.
For implementing this we have one architectural problem: PHP implements, for very good reasons, a shared nothing architecture. So one request from connection has no insight into another request/connection - but this is needed for the upload progress. [...] The obvious solution, of course, would be to use PHP's session handling system for this. [...] Now there were some technical issues why this wasn't done at first ... but then Arnaud Le Blanc sat down and created a proper implementation of an upload progress storage handler which has been commit to PHP trunk. Long story short: In the next version of PHP (5.4?) you will, most likely, have an Upload Progress mechanism built-in.
If you want all of the details on it, you can check out the RFC on it. Johannes shows a sample of the settings and code that, once the next release of PHP comes out, you can use to enable the extension and be able to poll the session for the progress details.
voice your opinion now!
file upload extension trunk sessions progress
|
Community Events
Don't see your event here? Let us know!
|