 |
Upload Image Without Refresh Page - Asynchronous Image File Upload Without Ajax
Author: Asif Khalyani  | Posted: 23-06-2008 | Comments: 0 | Views: 178 | Rating: (75) (?)
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.
Rate this Article:
Current: 5 / 5 stars - 1 vote(s).
Article Source: http://www.articlesbase.com/programming-articles/upload-image-without-refresh-page-asynchronous-image-file-upload-without-ajax-458806.html
About the Author:I am Asif Khalyani. I am software Engineer. PHP and ajax free script download site phpasks
|
Submitting articles has become one of the most popular means to drive traffic to your website and promote yourself and your business. Join us today - It's Free! |
|
Related Articles
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.
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.
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.
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.
Web Design India, Website, Software Development, Php, Net, Designers, Developers, Outsourcing, Consultancy, Call Center, Bpo, Solutions, Services, Seo By: Vishwash Gaur | 08/12/2007 | Online Promotion We are a growing India based company with local presence in USA and Canada. Viztech IT Solutions Limited features an integrated team of software professionals, web developers, creative designers, content writers, call center executives, programmers and professionals that assure you to get faster & better online results. Our expertise guarantees quality, competent and rapid execution of any projects - from small websites to complex softwares and custom solution programming.
A Digital World Has Come By: Red1 | 13/04/2008 | Web Design The Internet has been around for sometime but its popularity started a little more than five years ago as more people gains access to public domain. As more Americans engage in online activities such as gaming, surfing, communicating with relatives and friends, and stock brokering, new companies are created. Now you have companies offering web design, web development, website hosting and SEO services. Aside from this, our age is growing up to careers like graphic design and web designers, types
Php and Lamp Software By: Levi Reiss | 03/11/2008 | Computers PHP is the most widely used web programming language. It is available for free and easy to download onto you Windows computer, even if it's one that you thought was obsolete. This article discusses the relationships between PHP and other LAMP components, the web server Apache, the database management system MySQL, and the operating system Linux.
Your First Goal Before Building a Website By: Tim Trice | 17/03/2007 | Internet So, you think you're ready to launch your new website, eh? You built your list of keywords? You know which ones you want to focus most on? You have your list of sites to publish your content and directories to list with? Great! Let me tell you something: it makes no difference if your page takes too long to load.
Got a Question? Ask.
Ask the community a question about this article:
Frequently Asked Questions
Download gain publishing gator.exe
By: ron | 26-10-2008
download gain publishing gator.exe
My coupons wont print!!
By: Robin | 20-10-2008
I have tried to print coupons and I go through the download coupon pirinter process and it just keeps repeating...everytime I click on print coupons it talks me through the download printer process again...I have yet to print a coupon but I think I have downloaded coupon printer 10 times ! whats up with that?
From which sites i can download ps2 games ?
By: hacker | 18-10-2008
from which sites i can download ps2 games ?
I have downloaded ps2 game dragon ball z budokai ...
By: kushal | 09-10-2008
i have downloaded ps2 game dragon ball z budokai tenkaichi 3 it dosent have iso file what do do???
How can you restrict images from public view?
By: myed | 01-10-2008
The website I've setup allows members to upload pictures. The pictures are stored in a directory. How can I keep them from being viewed by the public. Should I do this with PHP and an .htaccess file?
Trouble finding info on creating time limited demo versions
By: pjdou002 | 01-10-2008
Blackberry newbie question: how do you create a time limited evaluation version of software for Blackberry devices?
Q&A Powered by:
Latest Programming Articles
Mvc Design Pattern By: TuVinhSoft .,JSC | 14/11/2008 Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (View) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.
Advantages of Low Cost Contract Programmers in Freelance Programming By: Joanna Gadel | 12/11/2008 It observed that web industry is getting tougher thus the necessity of freelance contract programmer is required for developing more effective website with flexible features. This article states the fruitful advantages of freelance programmers in contract programming.
A Guide to Cnc Kits By: Martin Applebaum | 09/11/2008 CNC kits are a way in which to construct your CNC machine. This article will provide some information on these machines.
A Guide to Cnc Tube Bending Machines By: Martin Applebaum | 08/11/2008 Are you familiar with a CNC tube bending machine? This article will shed some light on the main function and components of this machine.
Ways to Hire Dedicated Php Programmers By: Jucick | 08/11/2008 It’s not at all easy to hire dedicated PHP programmers unless you know where and how to find them. Whether you need to fix, update or enhance your website you naturally want the job done quick and right.
Top 4 Reasons Why Addressing Web Accessibility is Important By: Matt Cave | 05/11/2008 There are very high chances that web accessibility is more important to the performance of your web site than you realize. Article takes a look at the top 4 reasons why it would be important to address the issue of web accessibility.
Xlphoto Printing, the Best Choice for Banner Printing and Poster Printing By: Vikram Kumar | 01/11/2008 Suppose, you have visited a tourist spot or a hill station; over there, you have witnessed some of the mesmerizing locations of serene nature.
Simple & Complete Gridview Functionality(dotnet 2.0) by Syed Shees Abidi By: Shees Abidi | 31/10/2008 My this article covers GridView functionality in a Complte,Simple & Precise way in ASP.NET(2.0),C#,SQLServer 2005.This article provides a single GridView which is capable of
~Displaying Data
~Updating it
~Deleting the existing records from database based on a Confirmation Message and
~Inserting a new record(which is beyond the implicit usage of GridView).
NOTE: The application requires three simple stored proc. named empins,empupd,empdel for updation insertion and deletion respectively
More from Asif Khalyani
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.
|
 |