文件字段 [英] File Field

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

问题描述

我正在编写ASP来处理excel文件并将

结果输出到文本文件。要浏览我想要处理的文件
来处理我使用文件字段返回文件的位置

。我的问题从这里开始,当我点击

浏览它显示我的硬盘并且我选择文件并且它显示在窗口中的
C:\ test1的.xls" ;.但是当我按下

按钮来处理它时会返回一个错误告诉我

该文件无法找到。我做了一点测试,发现即使我从我的

硬盘中选择了该文件,它仍然在服务器的c盘中查找它。 >
当我写文本文件时会发生同样的事情。保存它

到服务器而不是我的电脑

任何帮助将不胜感激

谢谢

解决方案

首先必须将文件上传到服务器,以便脚本能够处理它。

安全限制访问客户端附件。


我建议您将其分解为几步:

1)从客户端PC中选择文件

2)上传到服务器

3)服务器处理它并将文本文件保存到服务器。

4)用户获取提供给他们的链接,以便他们可以下载他们的电脑上的文件是




希望有所帮助,

-fs

"涡" <前******** @ telemundo.com>在留言中写道

news:0d **************************** @ phx.gbl ... < blockquote class =post_quotes>我正在编写ASP来处理excel文件并将
结果输出到文本文件。要浏览我想要处理的文件,我使用文件字段返回文件的位置。我的问题从这里开始,当我点击
浏览它显示我的硬盘并且我选择文件并且它显示在窗口C:\test1.xls中。但是当我按下
按钮来处理它时会返回一个错误,告诉我
该文件无法找到。我做了一些测试,并且发现即使我从我的
硬盘中选择文件,它也在服务器的c盘中寻找它
当我写这个时,同样的事情发生了文本文件。将它保存到服务器而不是我的电脑
任何帮助将不胜感激
谢谢



一个HTML" ; input type = File"表单字段用于将文件上传到

服务器,而不是从服务器下载文件。因此,当您单击

浏览按钮时,它会显示本地客户端计算机上的文件。

没有什么可以改变它。要浏览服务器上的文件

DOWNloading,您需要编写一个ASPX页面,显示给定目录中的文件,每个文件名都有一个超链接下载文件。


-

HTH,


Kevin Spencer

Microsoft MVP

..Net开发人员
http:// www。 takempis.com

我学的越多,我知道的就越少。


" Eddy" <前******** @ telemundo.com>在留言中写道

news:0d **************************** @ phx.gbl ... < blockquote class =post_quotes>我正在编写ASP来处理excel文件并将
结果输出到文本文件。要浏览我想要处理的文件,我使用文件字段返回文件的位置。我的问题从这里开始,当我点击
浏览它显示我的硬盘并且我选择文件并且它显示在窗口C:\test1.xls中。但是当我按下
按钮来处理它时会返回一个错误,告诉我
该文件无法找到。我做了一些测试,并且发现即使我从我的
硬盘中选择文件,它也在服务器的c盘中寻找它
当我写这个时,同样的事情发生了文本文件。将它保存到服务器而不是我的电脑
任何帮助将不胜感激
谢谢



对不起Eddy,我害怕我完全糊涂了。

你是什么意思卸载 ?


" Eddy" <前******** @ telemundo.com>在留言中写道

news:0e **************************** @ phx.gbl ... < blockquote class =post_quotes>我理解但是,我的代码试图从服务器而不是我的工作站卸载
文件,这就是我收到错误的原因,我希望它能够卸载文件从我的本地c:驱动器没有它认为我告诉它
从服务器c驱动器

-----原始消息---- -
首先必须将文件上传到服务器


脚本

处理它。
安全限制访问客户端文件。

我建议你将其分解为几个步骤:
1)从客户端PC中选择文件
2)上传到服务器
3)服务器进程它并将文本文件保存到


服务器。

4)用户获取一个链接呈现给他们,以便他们可以


下载文件到

他们的电脑。

希望有所帮助,
-fs

" Eddy" <前******** @ telemundo.com>在消息中写道
新闻:0d **************************** @ phx.gbl ...

我正在编写ASP来处理excel文件并将
结果输出到文本文件。要浏览我要处理的文件,我使用文件字段返回文件的位置。我的问题从这里开始,当我点击
浏览它显示我的硬盘并且我选择文件并且它显示在窗口C:\test1.xls中。但是,当我按下按钮来处理它时,它会返回一个错误,告诉我
无法找到该文件。我做了一些测试,发现即使我从我的硬盘中选择文件,它也在服务器的c盘中查找它。当我写文本文件时,会发生同样的事情。将它保存到服务器而不是我的电脑
任何帮助将不胜感激
谢谢





I am coding a ASP to process a excel file and output the
reults to a text file. To browse for the file that i want
to process i used the File field to return the location of
the file. My problem begins here when I click on the
browse it show me my harddrive and I slect the file and it
show up in the window "C:\test1.xls". however when I press
the button to process the it returns an error telling me
that the file cannot be found. I did a little testing and
found out that even though I am selecting the file from my
hardrive it is looking for it in the c drive of the server
Same thing happen when I write the text file. it save it
to the server not to my PC
Any help would be appreciated
Thanks

解决方案

The file must first be uploaded to the server in order for the script to
process it.
Security restricts access to client side files.

I suggest you break this into a few steps:
1) Pick the file from the client PC
2) Upload to the server
3) Server processes it and saves a text file to the Server.
4) User gets a link presented to them so they can then download the file to
their PC.

hope that helps,
-fs
"Eddy" <ex********@telemundo.com> wrote in message
news:0d****************************@phx.gbl...

I am coding a ASP to process a excel file and output the
reults to a text file. To browse for the file that i want
to process i used the File field to return the location of
the file. My problem begins here when I click on the
browse it show me my harddrive and I slect the file and it
show up in the window "C:\test1.xls". however when I press
the button to process the it returns an error telling me
that the file cannot be found. I did a little testing and
found out that even though I am selecting the file from my
hardrive it is looking for it in the c drive of the server
Same thing happen when I write the text file. it save it
to the server not to my PC
Any help would be appreciated
Thanks



An HTML "input type=File" form field is used for UPLOADING files TO the
server, not downloading files FROM the server. Therefore, when you click the
Browse button, it shows the files on the local client machine. There is
nothing that can be done to change this. To browse files on the server for
DOWNloading, you would need to write an ASPX page that shows the files in a
given directory, with a hyperlink on each file name to download the file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"Eddy" <ex********@telemundo.com> wrote in message
news:0d****************************@phx.gbl...

I am coding a ASP to process a excel file and output the
reults to a text file. To browse for the file that i want
to process i used the File field to return the location of
the file. My problem begins here when I click on the
browse it show me my harddrive and I slect the file and it
show up in the window "C:\test1.xls". however when I press
the button to process the it returns an error telling me
that the file cannot be found. I did a little testing and
found out that even though I am selecting the file from my
hardrive it is looking for it in the c drive of the server
Same thing happen when I write the text file. it save it
to the server not to my PC
Any help would be appreciated
Thanks



Sorry Eddy, I''m afraid I''m completely confused.
What do you mean by "unload" ?

"Eddy" <ex********@telemundo.com> wrote in message
news:0e****************************@phx.gbl...

i understand that but, my code is trying to unload the
file from server not my workstation , that is why I am
getting an error, i want it to unload the file from my
local c: drive not have it think that i am telling it to
do it from the servers c drive

-----Original Message-----
The file must first be uploaded to the server in order


for the script to

process it.
Security restricts access to client side files.

I suggest you break this into a few steps:
1) Pick the file from the client PC
2) Upload to the server
3) Server processes it and saves a text file to the


Server.

4) User gets a link presented to them so they can then


download the file to

their PC.

hope that helps,
-fs
"Eddy" <ex********@telemundo.com> wrote in message
news:0d****************************@phx.gbl...

I am coding a ASP to process a excel file and output the
reults to a text file. To browse for the file that i want to process i used the File field to return the location of the file. My problem begins here when I click on the
browse it show me my harddrive and I slect the file and it show up in the window "C:\test1.xls". however when I press the button to process the it returns an error telling me
that the file cannot be found. I did a little testing and found out that even though I am selecting the file from my hardrive it is looking for it in the c drive of the server Same thing happen when I write the text file. it save it
to the server not to my PC
Any help would be appreciated
Thanks


.



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

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