AJAX-Like File Uploads with jQuery | AJAX-Like File Uploads with jQuery AJAX file upload tutorial In this tutorial I will show you how to create simple AJAX file upload system using PHP and JavaScript. Tutorial info: Bookmark AJAX file upload tutorial Step 1 - AJAX file upload AJAX file upload tutorial First of all I have to say that to create a pure AJAX file upload system is not possible because of security limitations of JavaScript. The concept: Create a simple HTML form for file uploadSet the target to an iFrame which is on the actual page but not visibleCall a JavaScript function on form submit to display the animationAfter the PHP part finishes the upload process, then it hides the animation Creating the HTML file: The HTML file we will use in this article is quite simple. Code: <form action="upload.php" method="post" enctype="multipart/form-data" target="upload_target" > File: <input name="myfile" type="file" /><input type="submit" name="submitBtn" value="Upload" /></form> Besides this we need to add a bit more code to it. <p id="f1_upload_process">Loading... Server side code:
How To Do a CSS PopUp Without Opening a New Window Ever wonder how some people can get little CSS PopUp’s without opening an annoying window? I’ll explain how. One of its advantages is that it’s not blocked by blockers and you can place it wherever you like on your page. Please note that whenever I speak about a blanket, I’m referring to the transparent film that goes over the content to draw attention to the PopUp. Click Here For The Demo The CSS What this CSS does is position and style the general elements. The Javascript File Click Here To Download the CSSPopUp.js file. toggle(div_id) – This simply toggles the inserted div name from being displayed (display:block) to being hidden (display:none).blanket_size(popUpDivVar) – This resizes the blanket to fit the height of the page because there is not height=100% attribute. The HTML The HTML places two your two CSS elements with display being set to none by default. Using the attribute onclick in our <a> tags, we can call our function: popup(); to do everything we need. Related Posts
There's more to HTML escaping than &, <, >, and " A few days ago I tweeted: If I had a dollar for every HTML escaper that only escapes &, <, >, and ", I'd have $0. Because my account would've been pwned via XSS." This was exaggeration for effect—there aren’t many cases where a simple XSS injection could actually empty a bank account—but I wanted to make a point. By some coincidence, I’ve found myself working with various open source projects recently that take a half-assed approach to HTML escaping. This post is not an introduction to HTML escaping. Note that this post only discusses escaping, which is something entirely different (and far less complicated) than sanitizing. Escaping < and > isn’t enough The worst HTML escaper I’ve seen in a major open source project only escapes the < and > characters. For example, let’s say I have the following template, and I’m going to replace the placeholder values, indicated in [square brackets], with HTML-escaped user input: <a href="/user/[username]">[username]</a> Escaping &, <, >, ", ', `, , ! Why?
Ajax Image Upload without Refreshing Page using Jquery. Are you looking for ajax file/image upload and preview without refreshing page using Jquery. I had implemented this ajax form submitting using jquery.form plugin and used Arun Shekar's image cropping PHP code for uploading images. Just five lines of JavaScript code, Using this you can upload files, image and videos. Download Script Live Demo Javascript Code$("#photoimg").live('change',function(){})- photoimg is the ID name of INPUT FILE tag and $('#imageform').ajaxForm() - imageform is the ID name of FORM. index.php Contains simple PHP and HTML code. <form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'> Upload image <input type="file" name="photoimg" id="photoimg" /></form> Sample database design for Users. Users Contains user details username, password, email, profile_image and profile_image_small etc. ajaximage.php Contains PHP code. <? db.php Database configuration file, modify username, password, database and base url values.
7 trusted ajax file upload plugins using jquery | Web Developer Juice File Upload form elements are there since quite few years and these elements can cause headache to most of the frontend web developers as it is very difficult to reskin them and they posses only the basic functionality of file selection. However now with the advent in technology Ajax based File Up loader Plug-ins are rendering the frontend web developers with file type restriction, instant feedback, drag & drop functionality of HTML 5 and few other amazing features that will ease the task of web developers. The Seven Ajax File Upload Plug-ins for jQuery Upload possess the basic features such as Drag and Drop, Multiple File Uploads, Custom jQuery Upload Restrictions, Real Time indicators for tracking the progress. 1. With this plugins you can upload a maximum of five files in one go and this plug-in makes use of the hidden iframe for uploading the form data nevertheless the complete process of uploading is transparent and makes use of the Ajax Upload Library. 2. 3. 4. 5. 6. 7. That’s all!
Upload and Resize an Image with PHP Are you looking for image upload and Resize PHP script. I had implemented a simple PHP script to re-sizing image into different dimensions. It's very useful to your web projects to save hosting space and bandwidth to reduce the original image to compressed size. Download Script PHP Code This script resize an Image into two 60px and 25px. <? && ($extension ! $width,$height); imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1, $width,$height); $filename = "images/". Extention PHP funtion Finds file extensions. function getExtension($str) { $i = strrpos($str,"."); if (! $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } Download Script
Upload large or big file in PHP using .htaccess Advertisement I’ve seen that many of my friends are struggling with the uploads of the bigger or larger files in PHP. After looking at their struggle, i’m here to solve the problem of uploading larger or bigger files in PHP. Most of the web servers are configured such a way that a user can only upload the maximum file size of 2MB. Here is a small tips for you which you can use to upload such a large file using file field of the form and move_uploaded_file() function in PHP. 1) Create a .htaccess file in the root folder of web server. 2) Put the following code in side the .htaccess file and save it. php_value upload_max_filesize 20M php_value post_max_size 20M php_value max_execution_time 200 php_value max_input_time 200 Now you can upload the file-size up-to 20MB in a simple way using file field in your html form and move_uploaded_file() function available in PHP. You can change the above parameter to upload the bigger file size than 20MB. Popularity: 48% [?]
jQuery Form Plugin The following code controls the HTML form beneath it. It uses ajaxForm to bind the form and demonstrates how to use pre- and post-submit callbacks. AJAX response will replace this content. The following code controls the HTML form beneath it. It uses ajaxSubmit to submit the form. This page gives several examples of how form data can be validated before it is sent to the server. The following login form is used for each of the examples that follow. Form Markup: <form id="validationForm" action="dummy.php" method="post"> Username: <input type="text" name="username" /> Password: <input type="password" name="password" /> <input type="submit" value="Submit" /> </form> First, we initialize the form and give it a beforeSubmit callback function - this is the validation function. Validate Using the formData Argument Validate Using the jqForm Argument Validate Using the fieldValue Method Note You can find jQuery plugins that deal specifically with field validation on the jQuery Plugins Page. <? <? <?
jQuery Multiple File Upload Plugin v1.29 (2008-06-26) What is this? The Multiple File Upload Plugin ( jQuery.MultiFile ) is a non-obstrusive plugin for the jQuery Javascript library that helps users easily select multiple files for upload quickly and easily whilst also providing some basic validation functionality to help developers idenfity simple errors, without having to submit the form (ie.: upload files). How do I use it? Just add the multi class to your file input element. Use the maxlength property if you want to limit the number of files selected Use the accept property if you only want files of a certain extension to be selected (separate valid extensions with a "|"). PS.: Sever-side validation is always required. Advanced Usage Using your own selectors $(function(){ // wait for document to load $('#MyFileUpload').MultiFile(); }); Setting limit via script $(function(){ // wait for document to load $('#MyFileUpload').MultiFile(5 /*limit will be set to 5*/); }); Advanced configuration Using events Basic Examples Using class property ASP users eg
Drawing Routes onto MKMapView Using Unofficial Google Maps Directions API « iPhone/iPad geeks world As a startup you should use the great component named MKMapView that already exists in IPhone SDK since the version 3.0.0. It is so easy to implement some map related requirements with this useful component as long as you need to draw routes between two locations. Yes, the MkMapView component is great but if it would have got a directions support it should be a perfect piece of the SDK. You already know that the built-in Google Maps applications on IPhone has the directions support somehow but the feature lacks on the MKMapView component. To have the work done, two problems must be solved. Anyway, according to Google Mapki we could grab routing data between two locations by requesting the url below with a parameter set which are lean and mean. The parameters are self explaning saddr: Source location’s latitude and longtitude daddr: Destination location’s latitude and longtitude output: Passing the value ‘dragdir’ forces http response to be in json format (I guess)