此篇文章受密碼保護,請輸入密碼後閱讀。
- 12月 17 週四 201518:31
TEST
- 6月 01 週三 201612:12
上傳前預覽
<html>
<head>
<style type="text/css">.thumb-image{float:left;width:100px;position:relative;padding:5px;}</style>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<div id="wrapper" style="margin-top: 20px;"><input id="fileUpload" multiple="multiple" type="file"/>
<div id="image-holder"></div>
</div>
<head>
<style type="text/css">.thumb-image{float:left;width:100px;position:relative;padding:5px;}</style>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<div id="wrapper" style="margin-top: 20px;"><input id="fileUpload" multiple="multiple" type="file"/>
<div id="image-holder"></div>
</div>
- 5月 06 週五 201611:54
C# 載入資料夾內所有圖片
string bookNo = "01";
bookNo = Request.Params["no"] == null ? "01" : Request.Params["no"];
DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/" + bookNo));
if(!dir.Exists){
dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/01"));
bookNo = "01";
}
FileInfo[] files = dir.GetFiles();
StringBuilder sb = new StringBuilder();
foreach (FileInfo file in files)
{
sb.Append("<img src='' data-original='_img/bookImg/" + bookNo + "/" + file.Name + "' style='width:100%;' />");
}
bookImg.InnerHtml = sb.ToString();
bookNo = Request.Params["no"] == null ? "01" : Request.Params["no"];
DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/" + bookNo));
if(!dir.Exists){
dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/01"));
bookNo = "01";
}
FileInfo[] files = dir.GetFiles();
StringBuilder sb = new StringBuilder();
foreach (FileInfo file in files)
{
sb.Append("<img src='' data-original='_img/bookImg/" + bookNo + "/" + file.Name + "' style='width:100%;' />");
}
bookImg.InnerHtml = sb.ToString();
- 5月 06 週五 201611:54
判別行動裝置
var uA = navigator.userAgent;
if (uA.match(/iPod/) || uA.match(/iPad/) || uA.match(/iPhone/) || uA.match(/Android/) || uA.match(/Windows Phone/)) {
location.href = "xxx.aspx?no=" + no;
} else {
$(".pobBox").load("xxx.aspx?no=" + no);
$(".popDiv").show(); $(".popDivBg").show();
}
if (uA.match(/iPod/) || uA.match(/iPad/) || uA.match(/iPhone/) || uA.match(/Android/) || uA.match(/Windows Phone/)) {
location.href = "xxx.aspx?no=" + no;
} else {
$(".pobBox").load("xxx.aspx?no=" + no);
$(".popDiv").show(); $(".popDivBg").show();
}
- 5月 06 週五 201611:47
使用a 呼叫js 埋ga
<a class="viewBtn" href="javascript:showView('01')" onclick="ga('send', 'event', 'xxx', 'xxx', '1')"></a>
- 5月 06 週五 201611:45
C# 直接下載檔案
protected void LinkButton5_Click(object sender, EventArgs e)
{
string filename = "xxx.pdf";
//從Server端取得檔案
Stream FileStream;
FileStream = File.OpenRead(Server.MapPath("~/xxx/xxx.pdf"));
downloadBook(filename, FileStream);
}
protected void downloadBook(string filename, Stream FileStream)
{
Byte[] Buf = new byte[FileStream.Length];
FileStream.Read(Buf, 0, int.Parse(FileStream.Length.ToString()));
FileStream.Close();
{
string filename = "xxx.pdf";
//從Server端取得檔案
Stream FileStream;
FileStream = File.OpenRead(Server.MapPath("~/xxx/xxx.pdf"));
downloadBook(filename, FileStream);
}
protected void downloadBook(string filename, Stream FileStream)
{
Byte[] Buf = new byte[FileStream.Length];
FileStream.Read(Buf, 0, int.Parse(FileStream.Length.ToString()));
FileStream.Close();
- 4月 13 週三 201617:25
圖片按鈕 input file
way3
<div class="col-3 frmCaption">Attachments:</div>
<div class="col-9">
<label class="customUpload btnUpload btnM"> <span>Upload files</span>
<div class="col-3 frmCaption">Attachments:</div>
<div class="col-9">
<label class="customUpload btnUpload btnM"> <span>Upload files</span>
- 3月 30 週三 201610:41
[轉貼]上傳檔案前,JavaScript檢查檔案格式、大小
https://dotblogs.com.tw/topcat/archive/2009/02/20/7250.aspx
範例程式如下:
範例程式如下:
