⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 save.aspx

📁 applet在線上繪圖,允許在瀏覽器上繪圖,最後儲存成各式的圖檔
💻 ASPX
字号:
<%@ Page Language="C#" %>
<%
/*----------------------------------------------------------------------------
' This script accepts the image from the editor and saves it to a disk file.
' Then it asks the applet to redirect the browser to the 'view.asp'
' to prove that the image is saved successfully.
'----------------------------------------------------------------------------*/

// let's save images to the script's directory
string filePath = Server.MapPath("./");

HttpFileCollection postedFileCollection = Request.Files;

if (postedFileCollection.Count > 0) {
    HttpPostedFile postedFile = Request.Files[0];
    
    // we use here the file name suggested by the applet
    string fileName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf("\\")+1);

    // but you can use any naming strategy, for example:
    // fileName = "XYZ12345.PNG";

    // save the uploaded image
    postedFile.SaveAs(filePath+"\\"+fileName);
    
    // Ask the applet to redirect the user's browser to the 'view.aspx' page
    Response.Write("#SHOWDOCUMENT=view.aspx?filename=" + fileName + "\n");
}
else {
     // No file has been uploaded
     // Ask the applet to report the error to the browser's status line
     Response.Write("#SHOWSTATUS=No file has been uploaded\n");
}

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -