文件上传控制 [英] fileupload control

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

问题描述

我编写了用于文件上传控制的代码,这样,当我单击浏览时,文件的路径被存储而不是存储,而我需要将上传的文件存储在解决方案资源管理器下的floder中,并且文件名应存储在数据库.有人可以帮我吗?

clsAdminBLL.Saveresources(ddldocumenttype.SelectedItem.Text.ToString(),fudocs.PostedFile.ToString(),txttitle.Text.ToString(),Convert.ToDateTime(txtdate.Text.Trim()).ToString());

i wrote the code for fileupload control such that when i click browse the path of the file is being stored instead of that i need to store the uploaded file in a floder under solution explorer and the name of the file should be stored in the database.can anyone help me.

clsAdminBLL.Saveresources(ddldocumenttype.SelectedItem.Text.ToString(), fudocs.PostedFile.ToString(),txttitle.Text.ToString(), Convert.ToDateTime(txtdate.Text.Trim()).ToString());

推荐答案

Google[^] is your friend and I bet there a number of articles on CP if you can be bothered to search for them.


我惊讶于有多少个所谓的程序员不断在字符串对象上调用ToString.

您是在postfile上调用ToString,不是文件数据吗?您需要将文件数据存储为字节数组.您也可以在上传控件上使用文件名.
I am astounded at how many alleged programmers keep calling ToString on string objects.

You''re calling ToString on postedfile, is that not the file data ? you need to store the file data as a byte array, which is what it is. The filename is also available to you on the upload control.


希望对您有所帮助.

使用ASP.NET上传文件 [
I hope this would help you.

File Upload with ASP.NET[^]


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

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