ASP.net在后台获取FileUpload上传后的Flash文件的宽高??我的问题最牛逼,你们说是不!

lunar2008 2008-01-20 03:39:36
如提,我用fileupload控件上传了一个flash格式的a.swf文件,这时在后台(.cs文件中)请问如何得到它的宽度和高度,它和图片文件好像有很大区别~。。。
...全文
439 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
茻鄷 2008-10-22
  • 打赏
  • 举报
回复
mark
rxdlovewy 2008-08-26
  • 打赏
  • 举报
回复
有没有在后台上传Flash格式的代码 有的话请发到我的邮箱里 867548343@qq.com谢谢了。
kiyeer 2008-01-29
  • 打赏
  • 举报
回复
我就是用这个可以获得flash文件的高度和宽度啊。有什么问题?
lunar2008 2008-01-27
  • 打赏
  • 举报
回复
OK谢谢楼上的朋友啦,我找到过这方面的函数了,其实目的就是要获取上传flash文件的宽高,比如你放在网页上时它显示时不是距形的一个动画么,就是这个距形的宽高,我说的应该很好理解呀!
kiyeer 2008-01-22
  • 打赏
  • 举报
回复
可以用以下方法实现:
http://test.0579fw.com/mypane.aspx?down=ok&filepath=kiyeer%2f%bf%cd%bb%a7%c9%cf%b4%ab%2fManagedZLib.rar
下载上面的dll文件,放在项目的BIN文件中,并引用。
然后建立一个类flashinfo.cs:
内容如下:

using System;
using System.Collections;
using System.IO;
using System.Text;

namespace FW0579.CService
{
public class FlashInfo
{
private int width, height, version, frameCount, fileLength;
private float frameRate;
private bool isCompressed;
public bool founderr;
public string errmeg;

public FlashInfo(string filename)
{
if(!File.Exists(filename))
throw new FileNotFoundException(filename);
FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
BinaryReader reader = new BinaryReader(stream);
try
{
if(stream.Length < 8){
throw new ArgumentNullException();}
string flashMark = new string(reader.ReadChars(3));
if(flashMark != "FWS" && flashMark != "CWS"){
throw new ArgumentNullException();}
isCompressed = flashMark == "CWS";
version = Convert.ToInt32(reader.ReadByte());
fileLength = reader.ReadInt32();
byte[] dataPart = new byte[stream.Length - 8];
reader.Read(dataPart, 0, dataPart.Length);
MemoryStream dataStream = new MemoryStream(dataPart);
try
{
if(isCompressed)
{
ManagedZLib.ManagedZLib.Initialize();
ManagedZLib.CompressionStream zlibStream = new ManagedZLib.CompressionStream(dataStream, ManagedZLib.CompressionOptions.Decompress);
BinaryReader zlibReader = new BinaryReader(zlibStream);
MemoryStream memoryStreamDecompressed = null;
try
{
byte[] decompressedPart = new byte[fileLength - 8];
zlibReader.Read(decompressedPart, 0, decompressedPart.Length);
memoryStreamDecompressed = new MemoryStream(decompressedPart);
ProcessCompressedPart(memoryStreamDecompressed);
}
finally
{
if(memoryStreamDecompressed != null)
memoryStreamDecompressed.Close();
zlibReader.Close();
zlibStream.Close();
ManagedZLib.ManagedZLib.Terminate();
}
}
else
ProcessCompressedPart(dataStream);
}
finally
{
dataStream.Close();
}
}
finally
{
reader.Close();
stream.Close();
}
}

private void ProcessCompressedPart(MemoryStream stream)
{
BinaryReader reader = new BinaryReader(stream);
try
{
byte[] rect;
int nbits, totalBits, totalBytes;
nbits = reader.ReadByte() >> 3;
totalBits = nbits * 4 + 5;
totalBytes = totalBits / 8;
if(totalBits % 8 != 0)
totalBytes++;
reader.BaseStream.Seek(-1, SeekOrigin.Current);
rect = reader.ReadBytes(totalBytes);
frameRate = float.Parse(string.Format("{1}.{0}", reader.ReadByte(), reader.ReadByte()));
frameCount = Convert.ToInt32(reader.ReadInt16());
BitArray bits = new BitArray(rect);
bool[] reversedBits = new bool[bits.Length];
for(int i = 0 ; i < totalBytes ; i++)
{
int count = 7;
for(int j = 8 * i ; j < 8 * (i + 1) ; j++)
{
reversedBits[j + count] = bits[j];
count -= 2;
}
}
bits = new BitArray(reversedBits);
StringBuilder sbField = new StringBuilder(bits.Length);
for(int i = 0 ; i < bits.Length ; i++)
sbField.Append(bits[i] ? "1" : "0");
string result = sbField.ToString();
string widthBinary = result.Substring(nbits + 5, nbits);
string heightBinary = result.Substring(3 * nbits + 5, nbits);
width = Convert.ToInt32(FlashInfo.BinaryToInt64(widthBinary) / 20);
height = Convert.ToInt32(FlashInfo.BinaryToInt64(heightBinary) / 20);
}
finally
{
reader.Close();
}
}

private static long BinaryToInt64(string binaryString)
{
if(binaryString == null)
throw new ArgumentNullException();
long result = 0;
for(int i = 0 ; i < binaryString.Length ; i++)
{
result = result * 2;
if(binaryString[i] == '1')
result++;
}
return result;
}

public int Width
{
get
{
return this.width;
}
}

public int Height
{
get
{
return this.height;
}
}

public int FileLength
{
get
{
return this.fileLength;
}
}

public int Version
{
get
{
return this.version;
}
}

public float FrameRate
{
get
{
return this.frameRate;
}
}

public int FrameCount
{
get
{
return this.frameCount;
}
}

public bool IsCompressed
{
get
{
return this.isCompressed;
}
}
}
}


然后调用:
FlashInfo strFlash = New FlashInfo(strPath);
int flashWidth, flashHeight;
flashWidth = strFlash.Width;
flashHeight = strFlash.Height;
Animatrix 2008-01-21
  • 打赏
  • 举报
回复
确实是牛逼问题
这个没研究过。。。
Thie 2008-01-20
  • 打赏
  • 举报
回复
获得Flash舞台的大小?
没研究过。
LikeCode 2008-01-20
  • 打赏
  • 举报
回复
对flash知道的不多,但flash不是矢量的吗,这个应该没有象位图一样有宽高概念的吧,是不是?!
cherish024 2008-01-20
  • 打赏
  • 举报
回复
你这个问题本身和fieupload控件没有关系

只要考虑如何获取path上的文件宽高问题~~还有flash本来就是矢量,也没有个界限的高度和宽度~。。。

i0876 2008-01-20
  • 打赏
  • 举报
回复
这个还真没有研究过。
资源下载链接为: https://pan.quark.cn/s/1bfadf00ae14 松下电工数字压力传感器用户手册详细介绍了DP-100系列数字压力传感器,涵盖其技术参数、操作方法及适用场景等,适用于各类需要精准压力测量的工业环境。 双屏显示:主屏与输出动作同步,可同时显示当前值和基准值,便于实时监控与调整。显示屏为12段字母数字显示,数字清晰易读。 三色指示:屏幕颜色随传感器状态变化(红、绿、橙),便于快速判断工作状态。 紧凑结构:尺寸仅□30mm,适合空间狭窄的安装环境。 多种操作模式:提供RUN模式(日常操作)、菜单设定模式(深入设置如输出模式切换)及PRO模式(级功能如应差调整、复制设定)。 安全认证:DP-101(A)/102(A)型号通过特定认证,确保产品安全可靠。 复制功能:可通过数据通信将主传感器设定内容复制到其他传感器,减少人工设定错误,节省时间。 性能传感:具备精度,分辨率1/2,000,反应时间2.5ms(最长5,000ms可调),温度特性±0.5%F.S.,重复精度±0.1%F.S. 电子元件吸附检测:监测吸盘是否成功吸附电子元件。 总压力监测:测量管道或容器内的压力水平。 空气泄漏检测:通过压力变化检测泄漏情况。 DP-101□:适用于低压环境(-100kPa至100kPa)。 DP-102□:适用于压环境(0kPa至1MPa)。 订购时需根据实际需求选择合适型号,考虑传感器的适用范围和工作条件。手册提供详细订购流程及注意事项,包括相关认证信息(如韩国S标志)。 复制功能:通过数据通信将主传感器设定复制到其他传感器,支持多种设定模式,避免设定错误,节省时间。 操作模式:RUN模式用于日常监控,菜单设定模式用于深入设置,PRO模式提供级功能。 使用前需仔细阅读手册,了解各功能使用方法。遵循安全指南,正确安装和使用传感器,避免损坏。对于

62,244

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧