开发者

compressed file uploads in asp .net

My earlier question dealt with file upload as well but now I am trying to tackle file uploads of zip/rar file formats in c# asp.net

Code:

protected void cmdUpload_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string extension =     

            System.IO.Path.GetExtension(FileUpload1.FileName).ToUpper();
            if (extension == "zip" || extension == "rar" || extension == "tar")
            {
                FileUpload1.SaveAs(Serve开发者_如何学编程r.MapPath("FileArchive") + "\\" + 
                FileUpload1.FileName);
                Label1.Text = "Uploaded successfully";
            }
            else
            {
                Label1.Text = "Cannot accept file. Invalid Type.";
            }

        }
    }

I wrote this but it dint work. Is there a special way compressed file uploads should be handled ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜