如何上传照片并同时在同一窗口中显示 [英] How to upload a photo and displaying it in same window at the same time

查看:72
本文介绍了如何上传照片并同时在同一窗口中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI朋友,



如何将照片上传到aspx表单并在将照片保存到数据库之前同时显示它?



使用ajax或任何控件,请给我一个解决方案。

解决方案

 <   asp:FileUpload     ID   =  fileup1    runat   =  server   文字  = 浏览    /  >  

string FilePath = fileup1 .PostedFile.FileName;





其中''fileup1is''fileupload控件名称...


< blockquote>你好亲爱的,



你可以使用下面给出的图像控制 -



< asp :image id =Image2runat =serverwidth =317height =104xmlns:asp =#unknown>



上传后代码(当代码上传文件时)。你可以使用该文件如下例所示 -





imgstudy.ImageUrl = ImageNAme+?time =+ DateTime.Now.Ticks;



在图片网址中你必须用QueryString添加Tick。

它将给出正确的图像。


你好



你可以使用Ajax上传链接





http://www.asp.net / ajaxLibrary / AjaxControlToolkitSampleSite / AjaxFileUpload / AjaxFileUp load.aspx [ ^ ]



http://www.asp .net / ajaxLibrary / AjaxControlToolkitSampleSite / AsyncFileUpload / AsyncFileUpload.aspx [ ^ ]


HI Friends,

How to upload a photo to an aspx form and displaying it at the same time before saving the photo to the database....?

Using ajax or any control,please give me a solution.

解决方案

<asp:FileUpload ID="fileup1" runat="server" Text="Browse" />

string FilePath = fileup1.PostedFile.FileName;



where ''fileup1is'' the fileupload controll name...


Hello Dear ,

You Can use image control like given below--

<asp:image id="Image2" runat="server" width="317" height="104" xmlns:asp="#unknown">

After upload code (when code upload file at the location) .you can use that file Like this example below-


imgstudy.ImageUrl = "ImageNAme" + "?time=" + DateTime.Now.Ticks;

in the image url you have to add Tick with QueryString.
it will give correct image.


Hello

You can Use Ajax uploader Link


http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx[^]

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx[^]


这篇关于如何上传照片并同时在同一窗口中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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