我上传的预览图像 [英] preview image which i have uploaded

查看:75
本文介绍了我上传的预览图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我有一个在线教育网站,我在该网站上为特定用户上传了会话图像,并且当用户再次登录时,应在该会话中为正在运行会话的特定用户显示该图像. class ="h2_lin">解决方案

您需要生成一些HTML,例如

 <   img     alt   ="     src   ="    / >  



如果不清楚,我不知道该怎么建议.对于拥有在线教育网站"的任何人来说,这太简单了.

—SA


希望这对您有所帮助.
此代码在Vb.net中,用于将文件保存在文件夹中
另一种方法是存储在数据库中.


此行用于获取与当前页面相关的目录
了解Server.MapPath()


1.Dim strSavelocation As String = Server.MapPath("..")

在这里,我要保存要上传的图像的文件夹(目录)
我的文件夹名称是目录"文件夹中的"Customimage"
我的网页在另一个文件夹中


2.strSavelocation = strSavelocation& "/Contents/customimage/"

您在这里获取要上传的图片名称(例如Codeproject.jpg)

3. strFileName = FileUpload1.FileName.ToString()

4. strSavePath = strSavelocation& strFileName

在这里您可以检查是否存在同名文件
我正在调用检查文件是否存在的方法
在第6行.
然后使用saveas(pathtosave)将该图像文件保存在文件夹中
ext pathtosave ="../contents/customiamge/codeproject.jpg"

为此,您必须将带有customermaster表的文件名存储在数据库中



5.如果不是Check_file_Exist(strSavePath)则


FileUpload1.SaveAs(strSavePath)
如果结束


6.公共函数Check_file_Exist(ByVal FileName作为字符串)为布尔值
试试
如果File.Exists(FileName)= True,那么
返回True
其他
返回False
如果结束

异常捕获
返回False
结束尝试

结束功能

到这里,我们保存了文件及其名称以及客户详细信息
现在,当用户登录时,从表和文件夹(保存图像文件夹)的路径中获取文件名,并设置为img标签的src属性


谢谢.


sir i have online education website in which i have upload image on session for a particular user and when again user login oh at that time the image shoud be displayed for a particular user whose session is running.imige preview coding.

解决方案

You need to produce some HTML like

<img alt="Uploaded image" src="uploadedImage.png" />



If this is not clear, I don''t know what to advise. This is way too elementary stuff to anyone who has an "online education website".

—SA


I hope this wil help you.
This Code is in Vb.net which is used to save file in folder
other way is to store in database.


This Line Is used to get the directory related to the current page
Understand Server.MapPath()


1.Dim strSavelocation As String = Server.MapPath("..")

Here I am taking the folder(directory) where i want to save the uploaded Images
My Folder name is "Customimage" which is in "Contents" folder
and my web page is in other folder


2.strSavelocation = strSavelocation & "/Contents/customimage/"

Here u take Image name being uploaded(ex.Codeproject.jpg)

3. strFileName = FileUpload1.FileName.ToString()

4. strSavePath = strSavelocation & strFileName

here you can check whether file with the same name exist
I am calling method to check file exist
which is at line 6.
Then saving that image file in the folder using saveas(pathtosave)
ext pathtosave="../contents/customiamge/codeproject.jpg"

and with this you have to store the file name with the customermaster table in database



5. If Not Check_file_Exist(strSavePath) Then


FileUpload1.SaveAs(strSavePath)
End If


6.Public Function Check_file_Exist(ByVal FileName As String) As Boolean
Try
If File.Exists(FileName) = True Then
Return True
Else
Return False
End If

Catch ex As Exception
Return False
End Try

End Function

Till here we saved file and its name with customer details
Now when user logged in take the file name from table and path for the folder(save image folder) and assing to src property of img tag


Thanks.


这篇关于我上传的预览图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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