无法使用文件路径查看图像 [英] unable to view image using file path

查看:65
本文介绍了无法使用文件路径查看图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

问题:无法使用FilePath显示图像



我有文件上传按钮,捕获文件路径&当我点击上传按钮时,它应该显示我选择的图像。但它没有发生?



我错过了什么?我需要将路径转换为图片网址??如果是,请提供给我背后的代码?



提前致谢..



< pre lang =vb> 受保护的 Sub Button1_Click(发件人正如 对象,e As System.EventArgs)句柄 Button1.Click
Dim path As String

path = Server.MapPath(FileUpload1.FileName)

Image1.ImageUrl = path
Label1.Text = Image1。 ImageUrl
结束 Sub

解决方案

我错过了什么?我需要将路径转换为图片网址??如果是,那么请提供我背后的代码??

是的,您需要先在特定位置上传图像,然后将该路径引用到图像源。



FileUpload控件一般不会显示整个路径,也无法帮助您按原样提取和使用。


Dear all,
Issue: Unable to display image using FilePath

I have File Upload button which captured the file path & when I click on Upload button, it should be display the image which I have selected. But its not happening?

What I missed here?? do I need to convert the path to image url?? If Yes then please provide me the code behind it??

Thanks in advance..

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim path As String

        path = Server.MapPath(FileUpload1.FileName)

        Image1.ImageUrl = path
        Label1.Text = Image1.ImageUrl
End Sub

解决方案

What I missed here?? do I need to convert the path to image url?? If Yes then please provide me the code behind it??
Yes, you need to first upload the image at certain location and then refer that path to the image source.

FileUpload control does not show the entire path generally and will not help you to extract and use as is.


这篇关于无法使用文件路径查看图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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