如何在浏览器中查看文件的内容 [英] How to view the content of a file in a browser

查看:600
本文介绍了如何在浏览器中查看文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我有一个上传按钮,用户可以在其中选择文件,选择文件后
并将其提交保存到数据库中,并且当用户单击预览按钮时
我想在浏览器中显示内容.
我该怎么办.请提供示例代码或项目


谢谢和问候,
Priya

Hi Friends,

I have an uploaded button where user can select an file and when the file is selected
and submitted it is saving to database and when the user click the preview button
i want to display the content in a browser.
How can i do this.Please provide me sample code or project


Thanks and Regards,
Priya

推荐答案

您可以尝试执行此操作(我假设文件为图像文件)
在表格中添加两个字段
1.ActualImageUrl 2. ReviewUrl

1.第一次上传文件时,Chnage ReviewUrl字段
(您可以从ReviewUrl字段中获取文件网址以显示评论页面)
2.如果用户在查看评论后取消并不保存,则什么也不做
3.如果用户同时保存了两个字段ActualImageUr,则ReviewUrl
(此处的评论网址已更改,因为用户可以直接保存而不查看评论)
You can try this (I am assuming file as image file)
Add two fields to your table
1.ActualImageUrl 2. ReviewUrl

1.When first time you upload file chnage ReviewUrl field
(you can get file url from ReviewUrl field to display review page)
2.If user cancel after seeing review & dont save then do nothing
3.If user saves chage both field ActualImageUr, ReviewUrl
(Here ReviewUrl changed because user may directly save without looking review)


这篇关于如何在浏览器中查看文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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