Archive

Posts Tagged ‘Ajax’

Trade Data Reporting Systems

August 12, 2009 ppshein Leave a comment
Trade Data

Trade Data

Trade data, one of my reporting systems project make me proud. Because I could do what I want to use cool tools in this project. I’ve added Graph features and temp tables of CFMX7. Our client can view monthly reports, yearly report, comparison reports, by commodity reports, badget year reports, by country reports of Export and Import product. It’s very good project for our client who is runing as Stock control Systems.

Systems :

CFMX7, SQL 2005, Ajax and javascript.

Upload files with jQuery, Ajax and PHP.

May 22, 2009 ppshein Leave a comment

In these days jQuery and Ajax are so popular in web development. One of my clients told me that, they want to upload multiple files without clicking button. That’s why I have had an idea to integrate jQuery, Ajax and PHP.

Download jQuery Here

Download ajax jQuery plugin

Create Upload Button like

<div id="upload_button">Upload</div>

Write following simple coding in your upload form

// You must create it only after the DOM is ready for manipulations
// Use $(document).ready for jquery
// document.observe("dom:loaded" for prototype
new AjaxUpload('upload_button_id', {action: 'upload.php'});

Configure at Ajax Upload

new AjaxUpload('#upload_button_id', {
  // Location of the server-side upload script
  action: 'upload.php',
  // File upload name
  name: 'userfile',
  // Additional data to send
  data: {
    example_key1 : 'example_value',
    example_key2 : 'example_value2'
  },
  // Submit file after selection
  autoSubmit: true,
  // The type of data that you're expecting back from the server.
  // Html (text) and xml are detected automatically.
  // Only useful when you are using json data as a response.
  // Set to "json" in that case.
  responseType: false,
  // Fired after the file is selected
  // Useful when autoSubmit is disabled
  // You can return false to cancel upload
  // @param file basename of uploaded file
  // @param extension of that file
  onChange: function(file, extension){},
  // Fired before the file is uploaded
  // You can return false to cancel upload
  // @param file basename of uploaded file
  // @param extension of that file
  onSubmit: function(file, extension) {},
  // Fired when file upload is completed
  // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
  // @param file basename of uploaded file
  // @param response server response
  onComplete: function(file, response) {}
});

Add following coding in your upload form

//You can use these methods, to configure AJAX Upload later.
var upload = new AjaxUpload(‘#div_id’,{action: ‘upload.php’});
//For example when user selects something, set some data
upload.setData({‘example_key’: ‘value’});

//Or you can use these methods directly inside event function
new AjaxUpload(‘div_id’, {
action: ‘upload.php’,
onSubmit: function() {
// allow only 1 upload
this.disable();
}
});
});

Here is server-side script, upload.php

move_uploaded_file($_FILES["file"]["tmp_name"],
“upload/” . $_FILES["file"]["name"]);

Best Credit To : http://valums.com/ajax-upload

ASP.NET ajaxtoolkit control

January 12, 2009 ppshein Leave a comment

I thought, asp.net is complicated to implement for web feature with ajax technology. When I visited one website showing about ASP.NET ajax control, what I thought is quite funny. Because we can implement all what we want in Web development with ASP.NET AjaxToolKit.

You can learn how to use this toolkit in this website.

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/

Categories: ASP.NET #C, Ajax Tags: ,

Ajax upload with ColdFusion

September 2, 2008 ppshein Leave a comment

I’ve once wrote file upload with flash. But I’m thinking of the weak point of this program would be alright if users don’t have flash player as well as using with GuestAccount. That’s I need to consider how to solve this problem and want to do file upload with Ajax. Eventually, I can do it. Here is coding.

index.cfm

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>AJAX File Uploader</title>
<script language=”javascript” type=”text/javascript”>
<!–
function startUpload(){
document.getElementById(‘f1_upload_process’).style.visibility = ‘visible’;
document.getElementById(‘f1_upload_form’).style.visibility = ‘hidden’;
return true;
}

function stopUpload(success){
var result = ”;
if (success == 1){
result = ‘<span class=”msg”>The file was uploaded successfully!<\/span><br/><br/>’;
}
else {
result = ‘<span class=”emsg”>There was an error during file upload!<\/span><br/><br/>’;
}
document.getElementById(‘f1_upload_process’).style.visibility = ‘hidden’;
document.getElementById(‘f1_upload_form’).innerHTML = result + ‘<label>File: <input name=”myfile” type=”file” size=”30″ /><\/label><label><input type=”submit” name=”submitBtn” class=”sbtn” value=”Upload” /><\/label>’;
document.getElementById(‘f1_upload_form’).style.visibility = ‘visible’;
return true;
}
//–>
</script>
</head>

<body>
<form action=”upload.cfm” method=”post” enctype=”multipart/form-data” target=”upload_target” onsubmit=”startUpload();” >
<p id=”f1_upload_process”>Loading…<br/><img src=”loader.gif” /><br/></p>
<p id=”f1_upload_form” align=”center”><br/>
<label>File:
<input name=”myfile” type=”file” size=”30″ />
</label>
<label>
<input type=”submit” name=”submitBtn” value=”Upload” />
</label>
</p>

<iframe id=”upload_target” name=”upload_target” src=”#” style=”width:0;height:0;border:0px solid #fff;”></iframe>
</form>
</body>

Upload.cfm

<cffile action=”UPLOAD” filefield=”myfile” destination=”#application.fpath#test/ajaxupload/files/” nameconflict=”MAKEUNIQUE”>
<cfset myfile = file.serverfile>

<script language=”javascript” type=”text/javascript”>window.top.window.stopUpload(‘1′);</script>

How? It’s easy thought, isn’t it?

Best Credit to : http://www.ajaxf1.com/download.html?item=12

Categories: Ajax, coldfusion Tags: , ,