473,396 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to allow user to upload only doc. file...

hello, is there a way i can control what user upload to
the webserver? i've created a upload feature and i dont
know howto control what the user uploads. i want to allow
my user to only upload .doc files. any help i greatly
appriciated...
yours truly

Mano Kumar
Nov 17 '05 #1
2 2562
You can pretty much only truly enforce this once the file has been uploaded.
Then you can get the content type of the file from your file upload control,
something like this:
File1.PostedFile.ContentType

If the ContentType isn't what you expected then you can simply ignore the
file (by not saving it anywhere) and display an appropriate message to your
user.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"mano kumar" <sc**@rocketmail.com> wrote in message
news:03****************************@phx.gbl...
hello, is there a way i can control what user upload to
the webserver? i've created a upload feature and i dont
know howto control what the user uploads. i want to allow
my user to only upload .doc files. any help i greatly
appriciated...
yours truly

Mano Kumar

Nov 17 '05 #2
You may even add check the contents of the file (all DOC files have more or
less the same structure). But Steve's right, you have to wait for the user
to upload the file. On the other hand, you don't even have to save it to a
disk if you reject it.

Jerry

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
You can pretty much only truly enforce this once the file has been uploaded. Then you can get the content type of the file from your file upload control, something like this:
File1.PostedFile.ContentType

If the ContentType isn't what you expected then you can simply ignore the
file (by not saving it anywhere) and display an appropriate message to your user.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"mano kumar" <sc**@rocketmail.com> wrote in message
news:03****************************@phx.gbl...
hello, is there a way i can control what user upload to
the webserver? i've created a upload feature and i dont
know howto control what the user uploads. i want to allow
my user to only upload .doc files. any help i greatly
appriciated...
yours truly

Mano Kumar


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Willoughby Bridge | last post by:
I am trying to create a php script to allows users to upload photos: The first file looks like this: <html> <head>
0
by: mano kumar | last post by:
hello, is there a way i can control what user upload to the webserver? i've created a upload feature and i dont know howto control what the user uploads. i want to allow my user to only upload...
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
3
by: Funky | last post by:
Hi, I have developed an ASP.NET application which has been running in production for around 3 months without any major glitches. Recently, a user was attempting to upload a rather large CSV file...
1
by: engwar | last post by:
I have a page that my users will go to to upload files to my website. As I want to reuse the file upload code on multiple pages I put the file upload textbox/buttons on a user control which I plan...
3
by: c676228 | last post by:
Hi everyone, I will develop a program to enroll a group of people on-line. Since we don't have number limitation for the people in the group. I am wondering if there is any company allow people...
1
by: Steve Richter | last post by:
How do I enable the file upload process to start as soon as the user selects the file? currently, I have two INPUT controls on the form. One is type=file and the other type=submit: <P><INPUT...
4
by: google.com | last post by:
Hi there! I've been digging around looking for a sample on how to upload a file without user action. I found the following article covering the area: ...
3
by: The Bicycling Guitarist | last post by:
Hello. I have many songs and essays pages that have been online more than ten years in some cases. These pages use HTML and CSS. Is there some way to allow visitors to add comments to these pages,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.