Skip to content

Instantly share code, notes, and snippets.

View shrimpwagon's full-sized avatar

Shawn Welch shrimpwagon

  • Summerville, SC
View GitHub Profile
@shrimpwagon
shrimpwagon / Odbc.php
Last active December 15, 2015 05:19 — forked from ceeram/Odbc.php
(NOT WORKING YET) CakePHP database class for specifically working with MS SQL Server via FreeTDS. Might be able to work with other ODBC databases, not sure. For more info on setting up a Linux/PHP/PDO/FreeTDS/MSSQL connection environment, please visit: https://secure.kitserve.org.uk/content/accessing-microsoft-sql-server-php-ubuntu-using-pdo-odb…
<?php
/**
* ODBC layer for DBO
* Helpful for Linux connection to MS SQL Server via FreeTDS
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@shrimpwagon
shrimpwagon / html5-image-uploader.jquery.js
Last active April 12, 2018 02:57
HTML5 Image Uploader jQuery
$(document).ready(function() {
var IS_IE = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0);
$.fn.postFile = function(options) {
var $self = this;
var defaults = {
url: undefined,
type: "POST",
@shrimpwagon
shrimpwagon / html5_image_upload.php
Last active April 20, 2017 14:19
HTML5 Image Upload PHP
<?php
/*******************************************************************
* Get file sent by HTML5 FileReader/XHR
*******************************************************************/
function get_xhr_file()
{
$file_name = $_SERVER['HTTP_X_FILE_NAME'];
$file_size = $_SERVER['HTTP_X_FILE_SIZE'];
$file_type = $_SERVER['HTTP_X_FILE_TYPE'];
<?php
require_once('html5_image_upload.php');
$file = get_xhr_file();
// Original file name:
$name = $file['name'];
// Size of file:
@shrimpwagon
shrimpwagon / html5-image-uploader-example.php
Last active April 20, 2017 14:54
HTML5 Image Uploader Example HTML/PHP
<html>
<head>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="html5-image-uploader.jquery.js"></script>
<script>
$(document).ready(function() {
$('#file').postFile({
url: 'http://example.com/upload',
data: {