亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? uploadattachment.cs

?? BugNET is an issue tracking and project issue management solution built using the ASP.NET web applic
?? CS
字號:
// According to http://msdn2.microsoft.com/en-us/library/system.web.httppostedfile.aspx
// "Files are uploaded in MIME multipart/form-data format. 
// By default, all requests, including form fields and uploaded files, 
// larger than 256 KB are buffered to disk, rather than held in server memory."
// So we can use an HttpHandler to handle uploaded files and not have to worry
// about the server recycling the request do to low memory. 
// don't forget to increase the MaxRequestLength in the web.config.
// If you server is still giving errors, then something else is wrong.
// I've uploaded a 1.3 gig file without any problems. One thing to note, 
// when the SaveAs function is called, it takes time for the server to 
// save the file. The larger the file, the longer it takes.
// So if a progress bar is used in the upload, it may read 100%, but the upload won't
// be complete until the file is saved.  So it may look like it is stalled, but it
// is not.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using BugNET.BusinessLogicLayer;
using log4net;

namespace BugNET.UserInterfaceLayer
{
    /// <summary>
    /// Upload handler for uploading files.
    /// </summary>
    public class UploadAttachment : IHttpHandler
    {
        private static readonly ILog Log = LogManager.GetLogger(typeof(UploadAttachment));
       
        /// <summary>
        /// Initializes a new instance of the <see cref="Upload"/> class.
        /// </summary>
        public UploadAttachment()
        {
        }

        #region IHttpHandler Members

        /// <summary>
        /// Gets a value indicating whether another request can use the <see cref="T:System.Web.IHttpHandler"/> instance.
        /// </summary>
        /// <value></value>
        /// <returns>true if the <see cref="T:System.Web.IHttpHandler"/> instance is reusable; otherwise, false.</returns>
        public bool IsReusable
        {
            get { return true; }
        }

        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"/> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            // Example of using a passed in value in the query string to set a Id
            // Now you can do anything you need to witht the file.
            int IssueId = 0;
            if (context.Request.QueryString["id"] != null)
            {
                try
                {
                    IssueId = Convert.ToInt32(context.Request.QueryString["id"]);
                }
                catch (Exception err)
                {
                    IssueId = 0;
                }
            }

            if (IssueId == 0)
                return;

            if (context.Request.Files.Count > 0)
            {
                // get the applications path
                string tempFile = context.Request.PhysicalApplicationPath;
                // loop through all the uploaded files
                for (int j = 0; j < context.Request.Files.Count; j++)
                {
                    // get the current file
                    HttpPostedFile uploadFile = context.Request.Files[j];
                    // if there was a file uploded
                    if (uploadFile.ContentLength > 0)
                    {
                        bool isFileOk = false;
                        string[] AllowedFileTypes = HostSetting.GetHostSetting("AllowedFileExtensions").Split(new char[';']);
                        string fileExt = System.IO.Path.GetExtension(uploadFile.FileName);
                        if (AllowedFileTypes.Length > 0 && AllowedFileTypes[0].CompareTo("*.*") == 0)
                        {
                            isFileOk = true;
                        }
                        else
                        {

                            foreach (string fileType in AllowedFileTypes)
                            {
                                string newfileType = fileType.Substring(fileType.LastIndexOf("."));
                                if (newfileType.CompareTo(fileExt) == 0)
                                    isFileOk = true;

                            }
                        }

                        //if the file is ok save it.
                        if (isFileOk)
                        {
                            // save the file to the upload directory
                            int projectId = Issue.GetIssueById(IssueId).ProjectId;
                            Project p = Project.GetProjectById(projectId);

                            if (p.AllowAttachments)
                            {
                                IssueAttachment attachment;

                                if (p.AttachmentStorageType == IssueAttachmentStorageType.Database)
                                {
                                    int fileSize = uploadFile.ContentLength;
                                    byte[] fileBytes = new byte[fileSize];
                                    System.IO.Stream myStream = uploadFile.InputStream;
                                    myStream.Read(fileBytes, 0, fileSize);
                                    attachment = new IssueAttachment(IssueId, context.User.Identity.Name, uploadFile.FileName, uploadFile.ContentType, fileBytes, fileSize);
                                    attachment.Save();
                                }
                                else
                                {
                                    string ProjectPath = p.UploadPath;

                                    try
                                    {
                                        if (ProjectPath.Length == 0)
                                            throw new ApplicationException(string.Format(PresentationUtils.GetErrorMessageResource("UploadPathNotDefined"), p.Name));

                                        string UploadedFileName = String.Format("{0:0000}_", IssueId) + System.IO.Path.GetFileName(uploadFile.FileName);
                                        string UploadedFilePath = context.Server.MapPath("~\\Uploads\\" + ProjectPath) + "\\" + UploadedFileName;
                                        attachment = new IssueAttachment(IssueId, context.User.Identity.Name, UploadedFileName, uploadFile.ContentType, null, uploadFile.ContentLength);
                                        if (attachment.Save())
                                        {
                                            uploadFile.SaveAs(UploadedFilePath);
                                        }

                                    }
                                    catch (DirectoryNotFoundException ex)
                                    {
                                        if (Log.IsErrorEnabled) Log.Error(string.Format(PresentationUtils.GetErrorMessageResource("UploadPathNotFound"), ProjectPath), ex);
                                        throw;
                                    }
                                    catch (Exception ex)
                                    {
                                        if (Log.IsErrorEnabled) Log.Error(ex.Message, ex);
                                        throw;
                                    }

                                }
                            }
                        }
                        else
                        {
                            if (Log.IsErrorEnabled) Log.Error(string.Format(PresentationUtils.GetErrorMessageResource("InvalidFileType"), uploadFile.FileName));
                        }
                                                  
                    }
                }
            }
            // Used as a fix for a bug in mac flash player that makes the 
            // onComplete event not fire
            HttpContext.Current.Response.Write(" ");
        }

        #endregion
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕的久久| 日本中文字幕不卡| 92国产精品观看| 国产成人av一区二区三区在线观看| 亚洲男人的天堂在线aⅴ视频| 久久综合九色综合97婷婷女人| 色婷婷综合激情| 93久久精品日日躁夜夜躁欧美| 国产在线不卡视频| 麻豆高清免费国产一区| 视频一区视频二区在线观看| 亚洲国产欧美在线| 欧美高清在线精品一区| 国产日韩欧美综合一区| 国产日韩精品久久久| 国产欧美日韩麻豆91| 久久精品视频免费观看| 国产精品丝袜在线| 国产婷婷精品av在线| 国产精品高潮呻吟久久| 国产精品视频九色porn| 中文字幕中文字幕在线一区 | 国产精品成人免费精品自在线观看| 久久婷婷国产综合国色天香| 精品国产乱子伦一区| 日韩欧美卡一卡二| 久久麻豆一区二区| 国产精品久久久久久久久快鸭 | 一本高清dvd不卡在线观看| av成人老司机| 色综合天天在线| 欧美色涩在线第一页| 色偷偷久久一区二区三区| 色婷婷香蕉在线一区二区| 欧美日韩免费观看一区二区三区| 在线观看www91| 日韩精品一区二区三区四区视频 | 国产精品一区三区| 亚洲成人动漫精品| 美女视频网站久久| 国产一区二区调教| 一本色道久久综合狠狠躁的推荐| 国产精品一区二区三区四区| av一区二区三区四区| 欧美怡红院视频| 欧美一区二区三区影视| 一片黄亚洲嫩模| 亚洲国产精品影院| 国产乱码字幕精品高清av| 色综合天天性综合| 日韩一区二区免费在线电影| 视频一区国产视频| 欧美主播一区二区三区| 欧美午夜片在线观看| 五月天国产精品| 国产毛片精品视频| 欧美艳星brazzers| 久久久久久久久久久黄色| 亚洲自拍偷拍麻豆| 免费成人av资源网| 在线观看视频一区二区欧美日韩| 26uuu久久天堂性欧美| 亚洲人成人一区二区在线观看| 久久精品国产一区二区| 91成人免费电影| 中文字幕高清不卡| 激情小说欧美图片| 精品视频在线看| 国产精品久久久久久福利一牛影视 | 在线观看免费视频综合| 精品播放一区二区| 五月激情综合色| 色八戒一区二区三区| 国产日产欧美一区二区视频| 日韩vs国产vs欧美| 欧美色涩在线第一页| 国产精品成人在线观看| 国产盗摄精品一区二区三区在线| 成人国产精品免费观看动漫| 欧美电影免费提供在线观看| 午夜精品成人在线| 91在线视频18| 日本一区二区三区高清不卡| 国内精品在线播放| 日韩三级精品电影久久久 | 99久久婷婷国产精品综合| 久久久av毛片精品| 韩国成人福利片在线播放| 欧美电视剧在线看免费| 日本伊人色综合网| 成人一区在线看| 国产女同性恋一区二区| 91国产福利在线| 午夜精品成人在线视频| 久久欧美一区二区| 91原创在线视频| 日韩和欧美一区二区三区| 精品国产91乱码一区二区三区 | 国产精品视频麻豆| 欧美午夜精品久久久| 精品一区二区三区久久| 国产精品美日韩| 在线国产亚洲欧美| 国产精一区二区三区| 毛片av一区二区| 国产三级一区二区| 欧美综合视频在线观看| 久久精品噜噜噜成人av农村| 亚洲三级小视频| 日韩午夜激情免费电影| av在线不卡电影| 免费高清不卡av| 亚洲精品免费在线| 国产区在线观看成人精品| 欧美日韩国产天堂| kk眼镜猥琐国模调教系列一区二区| 亚洲高清不卡在线观看| 国产性做久久久久久| 欧美老年两性高潮| 99久久国产综合精品色伊| 蜜臀99久久精品久久久久久软件| 国产精品不卡在线| 久久女同精品一区二区| 欧美精品黑人性xxxx| 波多野结衣一区二区三区| 美女网站一区二区| 一区二区欧美精品| 国产精品你懂的在线| 久久久精品影视| 日韩一区二区三免费高清| 91福利国产精品| 91论坛在线播放| 成人av电影在线网| 国内精品久久久久影院色| 午夜精品一区二区三区免费视频 | 青青草伊人久久| 亚洲精品视频免费看| 国产精品私人影院| 国产亚洲精品aa午夜观看| 精品国产91久久久久久久妲己| 日韩一区二区三区三四区视频在线观看| 91传媒视频在线播放| 色老综合老女人久久久| 色吧成人激情小说| 日本国产一区二区| 欧美在线观看你懂的| 91福利国产成人精品照片| 色菇凉天天综合网| 欧美在线高清视频| 欧美日本乱大交xxxxx| 欧美三级一区二区| 欧美日韩国产免费| 欧美精品在线视频| 欧美日韩一区二区三区免费看| 91搞黄在线观看| 欧美人牲a欧美精品| ㊣最新国产の精品bt伙计久久| jizz一区二区| 极品销魂美女一区二区三区| 91官网在线免费观看| 91官网在线观看| 欧美色爱综合网| 欧美一区二区三区不卡| 精品国产一区久久| 久久综合久久综合久久| 国产欧美精品在线观看| 亚洲欧美日韩国产成人精品影院| 国产精品电影院| 五月婷婷综合网| 精品一区二区免费视频| jvid福利写真一区二区三区| 欧美性感一类影片在线播放| 日韩欧美123| 中文字幕在线一区免费| 一区二区成人在线| 久久电影网电视剧免费观看| 成人性生交大片免费看中文网站| 日韩欧美成人午夜| 国产亚洲1区2区3区| 一区二区欧美精品| 精品影视av免费| 99re这里只有精品视频首页| 久久综合色鬼综合色| 日韩精品亚洲专区| 99精品在线免费| 另类的小说在线视频另类成人小视频在线 | 欧美午夜一区二区三区免费大片| 欧美一三区三区四区免费在线看| 国产亚洲欧洲997久久综合| 中文字幕综合网| 蜜臀久久99精品久久久久久9| 国产91露脸合集magnet| 欧美色爱综合网| 日本一区二区三区在线不卡| 亚洲午夜久久久久久久久久久| 国精产品一区一区三区mba桃花 | 一区在线观看免费| 成人亚洲一区二区一| 亚洲高清在线精品| 懂色av一区二区三区免费看|