Remember Me
forgot your password?

Upload Image Without Refresh Page - Asynchronous Image File Upload Without Ajax


Through concept such as Ajax and scripting languages like PHP, we now have a much robust set tools with which to deal with imaging. Thorugh Ajax, we can dynamically load and display images without the rest of the page having to reload, which speeds up the process considerably. We also have more control over what the user sees while the screen or images load. Users are generally understanding of load times, provided that you let them know what is happening. Thorugh Ajax and a little PHP magic, we can help the user's experience be a seamless and enjoyable as possible.

The basic uploading, manipulating and dynamically displaing images using PHP and Ajax.

Uploading Images
I suppose it is neccessary to bring a little bad news to Ajax at this point, it is not possible to process a file upload through the XMLHtrtpRequest Object. The reason of this is that javascript has no access to your computer's file system. While this is somewhat disappointing, there are still ways to perform Ajax-like functionality for this wighout making use of the XMLHttpRequest Object. Clever developeres have discovered that you can use hidden iframes to post a form request, thereby allowing for a image upload wiothout refresh.

I am designing a website with ajax and php. My main target is doing everything without full page refresh. I have done everything completed. I solved it partially using IFRAME.

By setting the iframe's CSS display property to none, the element is persent on the page to be utilized by the upload form, but not visible to the end user. by assiging a name to the iframe tag, you can use the target attribute in the form tag to post the request to the hidden iframe. Once you have the iframe configured, you can perform any uploads you like, and then use Ajax to perform any extra functionality. Consider the following example, which will allow yout to upload an image to a folder of your specification. Consider the code, which will allow you to create application.

An Ajax-enabled file upload system that uses hidden iframes to hide the upload

The code to create form, with a hidden iframe for processing

As you can see, you are using the same functionality and you will now use it to load the recently uploaded image into your

web page dynamically and without a screen refresh. The uploading function will still perform your form submission, but it is now coupled with a function called downloading, which will fire once the process_upload.php script has finished uploading the image (determined by the onload evernt). The doneuploading function takes ther parent frame of the hidden iframe and the fine name as arguments. It then users Ajax to dyanmically load the image the speicified element of ther parent frame.

Im trying to create a page for a picture framing site where users can upload images to see how they would look framed.

Uploading images can be broken down into the three following steps which will be looked at in turn:

* An HTML form with a browse button to allow the client to choose which file to upload
* A script to process the upload, validate the file, name it and place it in the file system
* Lastly a page to advise the client the upload was a success
* Is there a AJAX based solution or PHP based solution to check the filesize a user is trying to upload via a form.
* If the filesize exceeds more than 2 MB we want to give a message to the user that they need to upload a smaller file

size.

You can upload ZIP file of all your images in one shoot. You can upload image using zip file.
* You can create zip file for image, doc file and other file.
* This script find only jpg file uploaded and other file deleted.
* You can set which extension allowed or not allowed using this script uploaded.

Asif Khalyani

I am Asif Khalyani. I am software Engineer. PHP and ajax free script download site phpasks

Rate this Article: 4.4 / 5 stars - 16 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Programming Articles
  • More from Asif Khalyani

Easy way to set up global API hooks

By: Apriorit Inc. | 28/12/2009
This article describes an easy way to set up system-wide global API hooks. It uses AppInit_DLLs registry key for DLL injection and Mhook library for API hooking. To illustrate this technique we will show how to easily hide calc.exe from the list of running processes.

Getting the Best in Ecommerce Website Development

By: Arun Kumar | 28/12/2009
To run an ecommerce site, one needs to get the site developed at the professional hands of an expert ecommerce web site developer. The developer would try to understand the exact business requirement of the client by discussing in detail about his/her business goal and target audience.

iPhone Applications Development: When the Best of Additional Applications Reverberate You

By: Arun Kumar | 28/12/2009
It all started with the launch of the revolutionary iPhone from the Apple stable. iPhone mobile application development is now one of the most advanced software program development areas where much of research has been poured onto.

Magento Development

By: Digisha Modi | 26/12/2009
Magento eCommerce Development is an incredibly advanced suite which enables you to have a shopping cart up and running in a very short time. Magento includes advanced reporting and analysis features which will increase your awareness of sales trends and other customer activity to enable you to tune your business for maximum efficiency. Its unique characteristics are unlimited flexibility, completely scalable architecture, professional and community support and smooth integration with 3rd party a

PSD to XHTML Conversion Services

By: Digisha Modi | 26/12/2009
To make a website easily visible and popular, making it browser compatible is very important. For this PSD to XHTML conversion is one of the most vital elements of Web designing. Its growing importance in the designing cannot be completely annulled. With the increasing competition among the web marketers, the importance of a good design with better usability has become the necessity of the present time.

Magento Extension Development

By: Digisha Modi | 26/12/2009
Magento is a feature-rich, professional open-source eCommerce solution that offers merchants complete flexibility and control over the look, content, and functionality of their online store. Magneto’s intuitive administration interface contains powerful marketing, search engine optimization and catalog-management tools to give merchants the power to create sites that are tailored to their unique business needs.

How to burn WMV video to DVD to enjoy on TV, xobx, PS 3 or other playwers

By: lyndon123 | 26/12/2009
WMV video is a one of the most pop format video we often use. Enjoy the WMV video on TV, Xbox, PS 3 or other DVD Players is often necessary in our common life. Now we can follow this simple guide to learn how to burn WMV to DVD Disc.

Mobile antivirus software is beginning to be an essential

By: brookepens | 25/12/2009
When it comes to our home computers and networks in the work place everyone ensures that they are protected by mobile antivirus software with protective firewalls. Unfortunately, there are still many people and businesses that do not realise that mobile phone antivirus software has become just as important to have as antivirus computer software.

Easy Ajax Inline Text Edit 2.0

By: Asif Khalyani | 09/09/2008 | Programming
A small piece of javascript reads al SPAN tags, checks if it has class="editText" and a id=. If that is true, it adds a onclick function. That onclick function will create a textfield or input (depending on the size of the editable text). Someone has the ability to edit the field. When the text field is blurred, it will read the contents, and starts a XMLHttpRequest and ‘sends’ the content + fieldname + any set vars to an update file.

Ajax Rating Script - Php & Mysql

By: Asif Khalyani | 09/09/2008 | Programming
Frequent visitors of ajax enabled websites, like ajaxian, have all witnessed them already: ajax rating widgets.

Crop Image File Size, Width & Height Using Php Script

By: Asif Khalyani | 03/07/2008 | Programming
Cropping and resizing your images for the Web is a common technique for creating smaller thumbnail images that download quickly.

Ajax Form Validation and Thread-safe Ajax

By: Asif Khalyani | 03/07/2008 | Programming
This is the PHP and AJAX form validation application you can create AJAX and PHP: Building Responsive Web Applications.

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.04, 1, w3)