protected void doUpload()
{
try
{
HttpPostedFile file = this.file1.PostedFile;
string fileContentType = file.ContentType; //文件类型
string fileExtension = System.IO.Path.GetExtension(file.FileName).ToLower(); //上传文件的扩展名
string F_Type = fileExtension.Substring(1, fileExtension.Length - 1);
string strNewPath = DateTime.Now.ToString("yyyyMMddHHmmssffff") + GetExtension(file.FileName);
file.SaveAs(Server.MapPath(picServer + strNewPath));
string FullPath = picServer + strNewPath;
string jsstr = "";
jsstr += "parent.uploadsuccess('" + FullPath + "','" + itemID + "');";
if (fileContentType == "image/bmp" || fileContentType == "image/gif" || fileContentType == "image/pjpeg")
{
if (add2ThumbImg.Checked == true) //设为缩略图
{
jsstr += "parent.add2ThumbImg('" + F_Type + "','" + FullPath + "');\r\n";
jsstr += "parent.setUploadImg('" + F_Type + "','" + FullPath + "');\r\n";
}
}
if (ChannelType != "Article")
{
jsstr += "parent.addDownUrl('" + ChannelType + "','" + FullPath + "');\r\n";
}
else //插入文章内容
{
jsstr += "parent.addUploadItem('" + F_Type + "','/','" + FullPath + "','300');\r\n";
}
WriteJs(jsstr);
}
catch
{
WriteJs("parent.uploaderror();");
}
}
protected: void __gc* doUpload()
{
try
{
HttpPostedFile __gc* postedFile = this->m->PostedFile;
String __gc* contentType = postedFile->ContentType;
String __gc* str2 = Path::GetExtension(postedFile->FileName)->ToLower();
String __gc* str3 = str2->Substring(1, (str2->Length - 1));
String __gc* str4 = String::Concat(DateTime::Now->ToString(S"yyyyMMddHHmmssffff"), this->a(postedFile->FileName));
postedFile->SaveAs(base->Server->MapPath(String::Concat(this->a, str4)));
String __gc* str5 = String::Concat(this->a, str4);
String __gc* str6 = S"";
String __gc* str7 = str6;
str6 = String::Concat(__gc new String __gc*[6] {
str7, S"parent.uploadsuccess(\'", str5, S"\',\'", this->b, S"\');"});
if ((((contentType == S"image/bmp") || (contentType == S"image/gif")) || (contentType == S"image/pjpeg")) && this->l->Checked)
{
str7 = str6;
str7 = String::Concat(__gc new String __gc*[6] {
str7, S"parent.add2ThumbImg(\'", str3, S"\',\'", str5, S"\');\r\n"});
str6 = String::Concat(__gc new String __gc*[6] {
str7, S"parent.setUploadImg(\'", str3, S"\',\'", str5, S"\');\r\n"});
}
if (this->g != S"Article")
{
str7 = str6;
str6 = String::Concat(__gc new String __gc*[6] {
str7, S"parent.addDownUrl(\'", this->g, S"\',\'", str5, S"\');\r\n"});
}
else
{
str7 = str6;
str6 = String::Concat(__gc new String __gc*[6] {
str7, S"parent.addUploadItem(\'", str3, S"\',\'/\',\'", str5, S"\',\'300\');\r\n"});
}
this->b(str6);
}
catch (Object __gc* obj1)
{
this->b(S"parent.uploaderror();");
}
}