This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ 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> |