文件上传控制 [英] fileupload control
问题描述
我编写了用于文件上传控制的代码,这样,当我单击浏览时,文件的路径被存储而不是存储,而我需要将上传的文件存储在解决方案资源管理器下的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());
推荐答案
^ ]是你的朋友,我敢打赌关于CP的文章数量,如果您不愿意去寻找它们的话.
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屋!