分配Seek(0,SeekOrigin.Begin); [英] assign Seek(0, SeekOrigin.Begin);

查看:93
本文介绍了分配Seek(0,SeekOrigin.Begin);的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我的代码有问题.
看看下面给出的行

 字符串目标;
FileUpload1.FileContent.Seek( 0 ,SeekOrigin.Begin);
FileUpload1.PostedFile.InputStream.Read(pic, 0 ,len); 



其中FileUpload是asp.net中的一个标签,用于上传文件.字符串目标已分配了一个jpeg文件.现在我想使用字符串目标代替Fileupload,有人可以告诉我如何使用它,或任何其他替代方法吗?
thnx

解决方案

要从fileUpload保存文件,最简单的方法是:

if(FileUpload1.HasFile)
      FileUpload1.SaveAs(target);


您必须根据需要使用正确的文件名来初始化目标.


为回应您在解决方案1中的评论,我给您更精确的解释.

我建议你:
1°)保存文件,如解决方案1中所述
2°)将已保存的ppt文件解析为jpg文件,如本链接中所述

http://stackoverflow.com/questions/2972263/ppt-slides-to-images [ ^ ]


hi i have a problem in code.
look at the lines given below

string target;
FileUpload1.FileContent.Seek(0, SeekOrigin.Begin);
FileUpload1.PostedFile.InputStream.Read(pic, 0, len);



where FileUpload is a tag in asp.net use to upload a file. the string target has assigned a jpeg file. now i want to use the string target in place of Fileupload can somebody tells me how to use it, or any alternative for that?
thnx

解决方案

For saving a file from a fileUpload, the easiest way is :

if(FileUpload1.HasFile)
      FileUpload1.SaveAs(target);


You have to initialize target with a correct filename according your needs.


In response of your comment in Solution 1, i give you somme more precise explanation.

I suggest you to :
1°) save the file like mentionned in Solution 1
2°) parse the saved ppt file in jpg file like described in this link

http://stackoverflow.com/questions/2972263/ppt-slides-to-images[^]


这篇关于分配Seek(0,SeekOrigin.Begin);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆