News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Master Zend Framework:
Create a Simple File Upload Form in Zend Framework 2
June 04, 2014 @ 11:51:06

On his "Master Zend Framework" site today Matthew Setter has a new tutorial showing you how to create a simple file upload through the forms handling in Zend Framework 2. The form will include three parts: an input filter, a form class and a controller action to request to show the resulting form.

Having trouble getting file uploads integrated into your forms in Zend Framework 2? Or are you just curious about how to do it, and you want a quick rundown? If either of these is you, come walk through today's post with me as I show you a simple example of how it's done - along with how to combine it with filters and validators. Before we get started, I could have composed the code in a much shorter form than have I've composed it. But my assumption is that you're likely using the full-stack framework.

He includes summaries describing each of the three parts of the setup and the code you'll need to create each. The validator checks for things like "too big", "too small" and the correct MIME type on the file given. The form itself only includes the file upload element with a description of "Attachment". The controller action creates the form instance and calls an "isValid" when the upload happens to execute the validation. He also throws in the view template to display the form itself.

0 comments voice your opinion now!
zendframework2 simple file upload tutorial form

Link: http://www.masterzendframework.com/forms-2/simple-file-upload-form

Christian Weiske:
PHP 5.6 Large file upload support
December 11, 2013 @ 11:09:47

Christian Weiske has posted information about a feature in the upcoming PHP 5.6 version of the language - large file upload support. This new feature allows files over 4GB to be uploaded correctly.

PHP version 5.6 brings support for file uploads larger than 2GiB. We can say "thank you" to Ralf Lang for the initial patch that fixes bug #44522 , which was open since 2008. During testing uploads of files with a size of 4 - 11GiB on my PHP-CGI setup, I noticed that files above 4GiB did not get uploaded correctly. Michael Wallner was quick to fix that bug, and now 5.6 has fully working support for big files.

PHP 5.6 is still in development and some other new features are slated to be added to it. You can find some of them listed in the RFC section of the PHP wiki.

0 comments voice your opinion now!
php56 large file upload bug patch

Link: http://cweiske.de/tagebuch/php-large-file-uploads.htm

Phil Sturgeon:
CurlFile and the Facebook SDK in PHP 5.5
August 30, 2013 @ 11:19:04

Phil Sturgeon has a new post to his site today looking at a new feature that's included with PHP 5.5, Curlfile, and how he uses it with calls to the Facebook API (and a fix to make it cooperate).

One of the features implemented in PHP 5.5 was CurlFile, a nice addition to the Curl extension to allow you to specify specific arguments as a file for upload. In previous versions (pre-PHP 5.5) the syntax looked like this: [@/foo/bar.jpg]. A little digging around lead me to try this syntax: [new CURLFile('/foo/bar.jpg','image/jpeg')]. Sadly while Curl was happy with this, the Facebook PHP SDK (v3.2.2) was not. It turns out the SDK will turn ANY value you send it in that params array into a string.

To get around the issue, he worked up his own fix to the Facebook PHP SDK and submitted a patch to get it introduced into the tool. He also includes a reminder to filter incoming user data for things containing the "@" too to prevent unwanted file transfers.

0 comments voice your opinion now!
curlfile curl file upload facebook sdk patch json

Link: http://philsturgeon.co.uk/blog/2013/08/curlfile-and-the-facebook-sdk-in-php-55

DesignShack.com:
How to Build a Dynamic Imgur Upload App Using jQuery & PHP
August 30, 2013 @ 09:51:03

On DesignShack.com Jake Rocheleau has a tutorial showing you how to create an image uploader that pushes the image over to the Imgr service.

In this tutorial I want to demonstrate how we can remotely mirror an image found elsewhere online and auto-upload to Imgur. It's possible to create a form handling user-uploaded images as well. But I wanted to keep the demo clean without needing to move user content onto the server. This process is very simple once you understand how APIs work.

He provides all of the code and guidance you'll need to get the system working. It uses a simple HTML layout, some jQuery for submitting the image data back to the the server and a PHP script to call the Imgr API. It uses curl to make the call, so you'll need that extension installed to use the example. You can check out the live demo or just download the source to get started quickly.

0 comments voice your opinion now!
imgr upload jquery tutorial javascript api curl

Link: http://designshack.net/articles/javascript/how-to-build-a-dynamic-imgur-upload-app-using-jquery-php/

Amazon Web Services PHP Blog:
Syncing Data with Amazon S3
June 28, 2013 @ 11:57:59

On the Amazon AWS blog there's a recent post showing you how to sync data with S3 and handle multiple files quickly and easily.

Have you ever needed to upload an entire directory of files to Amazon S3 or download an Amazon S3 bucket to a local directory? With a recent release of the AWS SDK for PHP, this is now not only possible, but really simple.

He includes example code for doing it both ways - upload and download syncing - as well as some options you can use to customize the connection. You can define things like ACL settings, the number of concurrent connections and if you want the debug options turned off or on.

0 comments voice your opinion now!
sync amazon s3 tutorial upload download

Link: http://blogs.aws.amazon.com/php/post/Tx2W9JAA7RXVOXA/Syncing-Data-with-Amazon-S3

Phil Sturgeon:
Package Watch Image Management
September 19, 2012 @ 12:32:14

Phil Sturgeon has a new post to his site talking about how he added image upload and management support to an application with an easy integration of two packages (pulled in via Composer).

To get this extra functionality I added two packages to my composer.json. [...] The first is Upload by Josh Lockhart (who built Slim and started PHP The Right Way). It's currently very basic as it's not been alive long, but for the job I needed to do it worked perfect.

The second package is the ImageWorkshop that let him easily resize the uploaded images and add a watermark to the corner. He also points out that this method of pulling together packages, each with their own specializations, is the "early days of a PHP renaissance" in how people will work with the language.

0 comments voice your opinion now!
image management composer package upload imageworkshop tutorial


Script-Tutorials.com:
Vimeo API - OAuth and Upload Example
July 16, 2012 @ 12:03:11

On the Script-Tutorials.com site there's a new tutorial showing how to use the Vimeo API to upload your content to their service:

Today I would like to continue talking about video. Last time we talked about Youtube, but today I decided to select Vimeo. [...] Our second example - Vimeo. In our new tutorial I will tell you how you can create Vimeo cross-uploader for your website. To achieve our idea we will use Vimeo Upload API. In the beginning, we should register at Vimeo here.

The full code for the upload script, the HTML for the frontend for it and the CSS to give it a little bit of style. You can see a demo of it here or just download the source.

0 comments voice your opinion now!
vimeo api upload example tutorial oauth


PHPMaster.com:
Tracking Upload Progress with PHP and JavaScript
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).

0 comments voice your opinion now!
track upload progress extension javascript tutorial progressbar


PHPMaster.com:
File Uploads with PHP
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.

0 comments voice your opinion now!
file upload tutorial introduction security contenttype filter


NetTuts.com:
How to Upload Files with CodeIgniter and AJAX
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.

0 comments voice your opinion now!
tutorial ajax upload codeigniter framework



Community Events





Don't see your event here?
Let us know!


install laravel podcast configure community language framework testing introduction interview unittest series refactor code developer threedevsandamaybe wordpress opinion list release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework