Skip to content

Instantly share code, notes, and snippets.

@cmcdonaldca
cmcdonaldca / ParseTest.java
Last active December 17, 2015 20:29
Example how to reproduce Parse.com REST File upload problem
import java.io.Console;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
[HttpPost]
public ActionResult Upload(HttpPostedFileBase file)
{
string fileName = System.IO.Path.GetFileName(file.FileName);
string path = System.IO.Path.Combine(Server.MapPath("~/Images"), fileName );
if (IMAGE_FILE_TYPES.Contains(Path.GetExtension(file.FileName).ToUpperInvariant()) && file.ContentLength <= MAX_FILE_SIZE)
{
file.SaveAs(path);
string base64Image = Convert.ToBase64String(System.IO.File.ReadAllBytes(path));
@cmcdonaldca
cmcdonaldca / Default.aspx
Created March 24, 2012 19:28
Using Rob Conery's C# Shopify API Wrapper
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ListView ID="Products" ItemPlaceholderID="items" runat="server">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="items" runat="server"></asp:PlaceHolder>