473,756 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2576
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.PostedFil e.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**@rocketmai l.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.ne t> wrote in message
news:e9******** ******@tk2msftn gp13.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.PostedFil e.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**@rocketmai l.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
2731
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
998
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 .doc files. any help i greatly appriciated... yours truly Mano Kumar
3
2848
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 InputFile control, selects a file, then clicks on the Upload button. The file is saved to a folder on the server and the message label displays the appropriate msg. The user control also has a SetFilePath method.. This is used by the page which includes...
3
1783
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 and ran into a strange problem. After roughly 3 minutes of processing, the application reprompted the user for their user name and password (NT authentication). At this point, the ASP.NET page re-fired the last event that it was processing.
1
1947
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 to include in multiple aspx pages where they'll be able to upload images for other purposes. On the first page that I'm working on where users will be doing the upload (which I'll call the 'parent' page) I also have a DataGrid where I display...
3
8008
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 to upload an excel sheet which contains data about the people in the group and the asp program can import the data into the program direclty, so the customer don't have to type each person's info individual sin it's error prone and time consuming...
1
1209
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 id="ScriptFile" type="file" runat="server"></P> <P><INPUT " id="buttonRun" type="submit" value="Upload and Run" runat="server"></P>
4
9182
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: http://www.motobit.com/tips/detpg_uploadvbaie/ It describes the vba code required to handle a very simple upload form:
3
3717
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, the way most blogs allow comments by visitors? Of course I want the capability of deleting spam. Would migrating to a content management system do the ticket, and if so, could these pages keep the same URLs they have had for ten years or more?...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.