如何为文件创建拖放字段? [英] How to create a drag and drop field for files?

查看:81
本文介绍了如何为文件创建拖放字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一种简单的方法来将文件引用到我的数据库中。我希望用户能够将文件从桌面(或其计算机上的任何其他位置)拖放到某种控件上,并将文件放在服务器上,数据库中的超链接指向服务器上的文件。在线阅读内容时,我发现Hyperlink数据类型使得您可以将文件拖到文本框中,它会自动创建指向该文件的超链接。我的想法是使用该超链接能够对服务器执行FileCopy,然后将控件中的值更改为服务器上的位置而不是用户的PC。尝试时,将文件放到文本框中时添加到文本框的超链接不是FileCopy可以使用的常规文件路径。它以 ... 开头,然后是井号内的文件路径,然后再次复制。此外,它不包含文件路径的起始部分,因此我不能使用Left(),Right()或Mid()函数将其解析为可用的文件路径。现在我没有想法。

I''m trying to create an easy way to get references to files into my database. I want users to be able to drag and drop a file from their desktop (or anywhere else on their computer) onto a control of some kind and have the file get placed on the server with a hyperlink in the database to the file on the server. In reading stuff online, I found out that the Hyperlink data type makes it so that you can drag a file onto a textbox and it will automatically create a hyperlink to that file. My idea was then to use that hyperlink to be able to do a FileCopy to the server and then change the value in the control to be the location on the server instead of the user''s PC. When tried, the hyperlink that gets added to the text box when the file is dropped onto it is not a regular file path that FileCopy can use. It starts with ... and then the file path inside pound signs and then duplicates that again. Also, it doesn''t include the starting part of the file path so I can''t use Left(), Right(), or Mid() functions to parse it down to a usable file path. Now I''m out of ideas.

推荐答案

Seth,

通过超链接字段搜索字节,Rabbit(我认为)帮助了其他一些人如何格式化这些字段。


您还应该看看:超链接字段简介


好吧,我现在知道为什么它具有存储在文本框中的值的所有部分。我将不得不看看我是否可以解析链接本身并使用它,但我怀疑它一旦我开始将它分开就会起作用。


还有另外一种方法拖放会更容易吗?
Well, I now know why it had all the parts to the value stored in the textbox. I''ll have to see if I can parse out the link itself and use that, but I doubt that it will work once I start pulling it apart.

Is there another way to do drag and drop that would be easier?


在访问中通常有很多方法可以做。


我没有使用Access中的超链接字段,所以如果我最后说错了,请原谅。


快速测试透露,在Ac2010中,当我拖放单个文件时,我会在字段中自动插入RELATIVE路径。这意味着很多../用我试过的文件回溯目录。 我认为你有同样的问题,你宁愿拥有绝对路径吗?
There are usually quite many ways to do things in access.

I have not worked with hyperlink fields in Access, so if I end up saying something wrong, please excuse me.

A quick test revealed that in Ac2010 when I drag and drop a single file, I get a RELATIVE path inserted automatically in the field. That means alot of "../" to backstep directories with the files I tried. I presume you have the same issue, and that you would rather have the absolute path?


这篇关于如何为文件创建拖放字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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