최초등록
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,51 @@
|
||||
<%@ WebHandler Language="C#" Class="FileDragDrop.Web.FileUpload" %>
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
|
||||
namespace FileDragDrop.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// StoreFile의 요약 설명입니다.
|
||||
/// </summary>
|
||||
public class FileUpload : IHttpHandler
|
||||
{
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
string check = context.Request["filestream"];
|
||||
check = Regex.Replace(check, " ", "+");
|
||||
byte[] bytes = Convert.FromBase64String(check);
|
||||
|
||||
string tempName = context.Request["filename"];
|
||||
string fileName = String.Format("{0}{1}", context.Server.MapPath("./Upload/"), HttpUtility.UrlDecode(tempName).TrimStart(' ')); //context.Server.MapPath(context.Request["filename"]);
|
||||
|
||||
string createDir = String.Format("{0}", context.Server.MapPath("./Upload")); // 경로
|
||||
DirectoryInfo di = new DirectoryInfo(createDir);
|
||||
if (!di.Exists)
|
||||
{
|
||||
di.Create();
|
||||
}
|
||||
|
||||
FileStream fs;
|
||||
|
||||
if (!File.Exists(fileName))
|
||||
fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
else
|
||||
fs = new FileStream(fileName, FileMode.Append);
|
||||
fs.Write(bytes, 0, bytes.Length);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
ASP.NET 응용 프로그램을 구성하는 방법에 대한 자세한 내용을 보려면
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433 을 방문하십시오.
|
||||
-->
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true"/>
|
||||
<customErrors mode="Off"/>
|
||||
<httpRuntime
|
||||
executionTimeout="90"
|
||||
maxRequestLength="512000"
|
||||
useFullyQualifiedRedirectUrl="false"
|
||||
minFreeThreads="8"
|
||||
minLocalRequestFreeThreads="4"
|
||||
appRequestQueueLimit="100"/>
|
||||
|
||||
</system.web>
|
||||
</configuration>
|
||||
@@ -0,0 +1,116 @@
|
||||
<%@ codepage = 65001%>
|
||||
<% session.codepage = 65001 %>
|
||||
<%Response.CharSet = "UTF-8"%>
|
||||
<!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 runat="server">
|
||||
<title>FileDragDrop</title>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
#silverlightControlHost {
|
||||
height: 100%;
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="Silverlight.js"></script>
|
||||
<script type="text/javascript">
|
||||
function onSilverlightError(sender, args) {
|
||||
var appSource = "";
|
||||
if (sender != null && sender != 0) {
|
||||
appSource = sender.getHost().Source;
|
||||
}
|
||||
|
||||
var errorType = args.ErrorType;
|
||||
var iErrorCode = args.ErrorCode;
|
||||
|
||||
if (errorType == "ImageError" || errorType == "MediaError") {
|
||||
return;
|
||||
}
|
||||
|
||||
var errMsg = "Silverlight 응용 프로그램에서 처리되지 않은 오류 " + appSource + "\n" ;
|
||||
|
||||
errMsg += "코드: "+ iErrorCode + " \n";
|
||||
errMsg += "범주: " + errorType + " \n";
|
||||
errMsg += "메시지: " + args.ErrorMessage + " \n";
|
||||
|
||||
if (errorType == "ParserError") {
|
||||
errMsg += "파일: " + args.xamlFile + " \n";
|
||||
errMsg += "줄: " + args.lineNumber + " \n";
|
||||
errMsg += "위치: " + args.charPosition + " \n";
|
||||
}
|
||||
else if (errorType == "RumtimeError") {
|
||||
if (args.lineNumber != 0) {
|
||||
errMsg += "줄: " + args.lineNumber + " \n";
|
||||
errMsg += "위치: " + args.charPosition + " \n";
|
||||
}
|
||||
errMsg += "메서드 이름: " + args.methodName + " \n";
|
||||
}
|
||||
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
function UploadClick() {
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
host.content.UploadFile.StartUpload();
|
||||
}
|
||||
|
||||
function AbortItemOver() {
|
||||
alert("허용 개수 초과");
|
||||
}
|
||||
|
||||
function AbortSizeOver() {
|
||||
alert("허용 용량 초과");
|
||||
}
|
||||
|
||||
function AbortExtensionNot() {
|
||||
alert("지원하는 확장자 아님");
|
||||
}
|
||||
|
||||
function AbortUploadNotFile() {
|
||||
alert("업로드 할 파일 없음");
|
||||
}
|
||||
|
||||
function NotifyUploadComplete() {
|
||||
alert("업로드 완료");
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
var uploadFile = new Array();
|
||||
uploadFile = host.content.UploadFile.UploadedFileName();
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
function AbortDeleteFile() {
|
||||
alert("삭제할 파일이 없음");
|
||||
}
|
||||
|
||||
function Initialize() {
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
host.content.UploadFile.Initialize();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server" style="height:100%">
|
||||
<input type="button" value="업로드" onclick="UploadClick()" />
|
||||
<div id="silverlightControlHost">
|
||||
<object id="SilverlightControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
|
||||
<param name="source" value="ClientBin/FileDragDrop.xap"/>
|
||||
<param name="onError" value="onSilverlightError" />
|
||||
<param name="background" value="white" />
|
||||
<param name="minRuntimeVersion" value="5.0.61118.0" />
|
||||
<param name="autoUpgrade" value="true" />
|
||||
<param name="initParams" value="paramUrl=http://aspmssqlwa.nninc.co.kr/dev/uploader/FileUpload.ashx, paramFilter=.jpg|.zip|.txt, paramMaxFileSize=104857600, paramMaxFileNumber=5, prarmControlWidth=700, paramControlHeight=400" />
|
||||
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none">
|
||||
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Microsoft Silverlight 얻기" style="border-style:none"/>
|
||||
</a>
|
||||
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,115 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" %>
|
||||
|
||||
<!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 runat="server">
|
||||
<title>FileDragDrop</title>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
#silverlightControlHost {
|
||||
height: 100%;
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="Silverlight.js"></script>
|
||||
<script type="text/javascript">
|
||||
function onSilverlightError(sender, args) {
|
||||
var appSource = "";
|
||||
if (sender != null && sender != 0) {
|
||||
appSource = sender.getHost().Source;
|
||||
}
|
||||
|
||||
var errorType = args.ErrorType;
|
||||
var iErrorCode = args.ErrorCode;
|
||||
|
||||
if (errorType == "ImageError" || errorType == "MediaError") {
|
||||
return;
|
||||
}
|
||||
|
||||
var errMsg = "Silverlight 응용 프로그램에서 처리되지 않은 오류 " + appSource + "\n" ;
|
||||
|
||||
errMsg += "코드: "+ iErrorCode + " \n";
|
||||
errMsg += "범주: " + errorType + " \n";
|
||||
errMsg += "메시지: " + args.ErrorMessage + " \n";
|
||||
|
||||
if (errorType == "ParserError") {
|
||||
errMsg += "파일: " + args.xamlFile + " \n";
|
||||
errMsg += "줄: " + args.lineNumber + " \n";
|
||||
errMsg += "위치: " + args.charPosition + " \n";
|
||||
}
|
||||
else if (errorType == "RumtimeError") {
|
||||
if (args.lineNumber != 0) {
|
||||
errMsg += "줄: " + args.lineNumber + " \n";
|
||||
errMsg += "위치: " + args.charPosition + " \n";
|
||||
}
|
||||
errMsg += "메서드 이름: " + args.methodName + " \n";
|
||||
}
|
||||
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
function UploadClick() {
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
host.content.UploadFile.StartUpload();
|
||||
}
|
||||
|
||||
function AbortItemOver() {
|
||||
alert("허용 개수 초과");
|
||||
}
|
||||
|
||||
function AbortSizeOver() {
|
||||
alert("허용 용량 초과");
|
||||
}
|
||||
|
||||
function AbortExtensionNot() {
|
||||
alert("지원하는 확장자 아님");
|
||||
}
|
||||
|
||||
function AbortUploadNotFile() {
|
||||
alert("업로드 할 파일 없음");
|
||||
}
|
||||
|
||||
function NotifyUploadComplete() {
|
||||
alert("업로드 완료");
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
var uploadFile = new Array();
|
||||
uploadFile = host.content.UploadFile.UploadedFileName();
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
function AbortDeleteFile() {
|
||||
alert("삭제할 파일이 없음");
|
||||
}
|
||||
|
||||
function Initialize() {
|
||||
var host = document.getElementById("SilverlightControl");
|
||||
host.content.UploadFile.Initialize();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server" style="height:100%">
|
||||
<input type="button" value="업로드" onclick="UploadClick()" />
|
||||
<div id="silverlightControlHost">
|
||||
<object id="SilverlightControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
|
||||
<param name="source" value="ClientBin/FileDragDrop.xap"/>
|
||||
<param name="onError" value="onSilverlightError" />
|
||||
<param name="background" value="white" />
|
||||
<param name="minRuntimeVersion" value="5.0.61118.0" />
|
||||
<param name="autoUpgrade" value="true" />
|
||||
<param name="initParams" value="paramUrl=http://aspmssqlwa.nninc.co.kr/dev/uploader/FileUpload.ashx, paramFilter=.jpg|.zip|.txt, paramMaxFileSize=104857600, paramMaxFileNumber=5, prarmControlWidth=700, paramControlHeight=400" />
|
||||
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none">
|
||||
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Microsoft Silverlight 얻기" style="border-style:none"/>
|
||||
</a>
|
||||
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user