文件上传 [英] File Uploading

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

问题描述

我有三天时间尝试编写一个代码来帮助我将几个链接文件(不同的扩展名)上传到访问数据库,并且还能够单击一个文件并能够查看文件内容。具体来说我想上传pdf,doc,bmp,gif,jpg。任何人都可以帮助我....!

I have three days trying to write a code that would help me upload several linked files (different extensions) to the access database and also be able to click on a single file and be able to view the file contents. Specfifically I want to upload pdf, doc, bmp, gif, jpg. Can anyone help me please....!

推荐答案


我有三天时间尝试编写一个代码帮助我上传几个链接文件(不同的扩展名)到访问数据库,也可以单击一个文件,并能够查看文件内容。具体来说我想上传pdf,doc,bmp,gif,jpg。任何人都可以帮助我....
I have three days trying to write a code that would help me upload several linked files (different extensions) to the access database and also be able to click on a single file and be able to view the file contents. Specfifically I want to upload pdf, doc, bmp, gif, jpg. Can anyone help me please....!



如果通过上传表示能够浏览并打开应用程序中的文件,请参阅以下链接:

http://www.mvps.org/access/api/api0001。 htm


浏览并打开带有源代码的免费演示mdb

http://www.candace-tripp.com/pages/ access_downloads.aspx#8

If by "uploading", you mean the ability to browse to and open files from within your application, see these links:

http://www.mvps.org/access/api/api0001.htm

Browse and Open Files-free demo mdb with source code
http://www.candace-tripp.com/pages/access_downloads.aspx#8


感谢您的回复。是的我想浏览文件选择我认为相关的文件到列表框中,然后在数据库中输入它们。在报告中查看它们时,我希望能够列出这些文件,并且可以选择打开其中一个文件来查看其内容。
Thanks for the reply. Yes I want to browse for files select files I consider relevant into a listbox and later enter them in the database. On viewing them in a report, I want to be able have the files listed and have an option of opening one of them to view its contents.


我设法搜索网络并找到了以下代码:


Private Sub cmdLoadOLE_Click()


将MyFolder作为字符串调暗

Dim MyExt As String

Dim MyPath As String

Dim MyFile As String

Dim strCriteria As String


MyFolder =我! SearchFolder

''获取搜索路径。

MyPath = MyFolder& " \" &安培; " * QUOT。 &安培; [SearchExtension]

''获取包含文件扩展名的路径中的第一个文件。

MyFile = Dir(MyPath,vbNormal)

Do而Len(MyFile)<> 0

[OLEPath] = MyFolder& " \" &安培; MyFile

[OLEFile] .Class = [OLEClass]

[OLEFile] .OLETypeAllowed = acOLELinked

[OLEFile] .SourceDoc = [OLEPath]

[OLEFile] .Action = acOLECreateLink

''检查文件夹中的下一个OLE文件。

MyFile = Dir

''转到表单上的新记录。

DoCmd.RunCommand acCmdRecordsGoToNew

循环


结束子

它的作用是,它允许你输入文件路径,类名和文件扩展名然后按下上传文件按钮,它将该扩展名的所有文件上传到数据库并显示一个 - 在-A-时间。

我的问题是将文件显示为图标链接列表,并显示与下面显示的每个链接相关联的名称,以便在单击图标时将其引导至关联文件。


亲切的问候。
I managed to search the net and found the following code:

Private Sub cmdLoadOLE_Click()

Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
'' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
'' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLELinked
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateLink
'' Check for next OLE file in the folder.
MyFile = Dir
'' Go to new record on form.
DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub

What it does is, it lets you enter the file path,ole class name and file extensions then on pressing the Upload Files button it uploads all files of that extension to the database and display them one-at-a-time.

My problem is making the files display as an icon-linked list and names associated with each link displayed underneath so that on clicking the icon it leads me to the associated file.

Kind Regards.


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

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