How can we assign file extension using FileUpload? 6 2754
What exactly are you trying to do and why?
Tell us more about what you want to accomplish, there may be a better/easier
way.
-KF
"ad" <ad@wfes.tcc.ed u.tw> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. How can we assign file extension using FileUpload?
I want to uer upload a excel file, I want to limit the file extension to
".xls"
<ke*****@nospam .nospam> ¼¶¼g©ó¶l¥ó·s»D: OK************* *@TK2MSFTNGP14. phx.gbl... What exactly are you trying to do and why?
Tell us more about what you want to accomplish, there may be a better/easier way.
-KF
"ad" <ad@wfes.tcc.ed u.tw> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. How can we assign file extension using FileUpload?
"ad" <ad@wfes.tcc.ed u.tw> wrote in message
news:OA******** ******@TK2MSFTN GP10.phx.gbl... I want to uer upload a excel file, I want to limit the file extension to ".xls"
protected HtmlInputFile txtFileName;
if(Path.GetExte nsion(txtFileNa me.PostedFile.F ileName) != ".xls"
{
// do something
}
you can use a asp:RegularExpr essionValidator to validate file extensions
a sample regular expression for XSL and CSV is
^[0-9A-Za-z_ ]+(.[xX][lL][sS]|.[cC][sS][vV])$
i am not good in regular exps, following site got lot of samples http://www.regexlib.com/REDetails.aspx?regexp_id=259
"Mark Rae" wrote: "ad" <ad@wfes.tcc.ed u.tw> wrote in message news:OA******** ******@TK2MSFTN GP10.phx.gbl...
I want to uer upload a excel file, I want to limit the file extension to ".xls"
protected HtmlInputFile txtFileName;
if(Path.GetExte nsion(txtFileNa me.PostedFile.F ileName) != ".xls" { // do something }
I have tried the RegularExpressi onValidator , but no effect!
"Sreejith Ram" <Sr*********@di scussions.micro soft.com> ¼¶¼g©ó¶l¥ó·s»D: 71************* *************** ******@microsof t.com... you can use a asp:RegularExpr essionValidator to validate file extensions
a sample regular expression for XSL and CSV is
^[0-9A-Za-z_ ]+(.[xX][lL][sS]|.[cC][sS][vV])$
i am not good in regular exps, following site got lot of samples
http://www.regexlib.com/REDetails.aspx?regexp_id=259
"Mark Rae" wrote:
"ad" <ad@wfes.tcc.ed u.tw> wrote in message news:OA******** ******@TK2MSFTN GP10.phx.gbl...
>I want to uer upload a excel file, I want to limit the file extension to >".xls"
protected HtmlInputFile txtFileName;
if(Path.GetExte nsion(txtFileNa me.PostedFile.F ileName) != ".xls" { // do something }
Well, the reason could be that the Regular expression you are using is wrong.
You may want to test the expression with a RegularExpressi on tester to see
if it works.
I have used RegularExpressi onValidator with file upload , in the past and it
used to work. Do not have access to the code now to post sample
"ad" wrote: I have tried the RegularExpressi onValidator , but no effect!
"Sreejith Ram" <Sr*********@di scussions.micro soft.com> ¼¶¼g©ó¶l ¥Ã³Â·s»D:71*** *************** *************** *@microsoft.com ... you can use a asp:RegularExpr essionValidator to validate file extensions
a sample regular expression for XSL and CSV is
^[0-9A-Za-z_ ]+(.[xX][lL][sS]|.[cC][sS][vV])$
i am not good in regular exps, following site got lot of samples
http://www.regexlib.com/REDetails.aspx?regexp_id=259
"Mark Rae" wrote:
"ad" <ad@wfes.tcc.ed u.tw> wrote in message news:OA******** ******@TK2MSFTN GP10.phx.gbl...
>I want to uer upload a excel file, I want to limit the file extension to >".xls"
protected HtmlInputFile txtFileName;
if(Path.GetExte nsion(txtFileNa me.PostedFile.F ileName) != ".xls" { // do something } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Terry Field |
last post by:
We've recently moved an application from a W2K server to a Windows 2003
server with IIS 6.0 and in the process managed to lose the ability to handle
file uploads. I've managed to identify that this is not specific to IIS 6.0
since we have another server that doesn't give me any problems in this
respect.
The test program below illustrates the problem. The Page_Load method never
resolves the IsPostBack property to true and the...
|
by: Paul |
last post by:
Hi there,
When adding a "File Field" HTML control to an aspx page to facilitate file
uploading, the following occurs:
1. You select a file that is larger than the allowed size limit.
2. Once the user selected the too large file, the page is redirected to a
"page not found" error page.
3. This is as per the docs, but my question is:
|
by: Marko Vuksanovic |
last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is it possible to implement it using some other control, for example a floating window?
|
by: Marko Vuksanovic |
last post by:
I am trying to cause the uplaod button, id="Upload",when clicked, to exectue the onClick event for Button1, id="Button1".
<asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>
<asp:Button id="Upload" Text="Upload file" runat="server"> </asp:Button>
<asp:Button id="Button1" OnClick="UploadButton_Click" runat="server" Visible="false">
in the code behind file I am using the following code to add the __doPostBack to the...
|
by: Arpan |
last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls.
Using the FileUpload control, I want to give users the provision to
move & delete files that DO NOT exist in C:\Inetpub\wwwroot (i.e. the
root directory). This is the code:
<script runat="server">
Sub MoveFile(ByVal obj As Object, ByVal ea As EventArgs)
File.Move(fudFileSource.FileName, txtFileDest.Text)
'File.Move("F:\4.jpg", "C:\4.jpg")
End Sub
| |
by: nicknack |
last post by:
Hello.
I would like to give my user the option to browse his files (like the
simple fileUpload control do) and after selecting the file (and when
the fileUpload control hold in his text box the full path and file
name) I want to press another button and get the path+file name as a
string.
I want to do this with out actually upload the file. I use the
fileupload just for his browsing option.
|
by: =?Utf-8?B?TW9uaWNh?= |
last post by:
Hi,
I want when I click on Browse button (FileUpload Control), I see just image
extensions not anything else.
How can I do this?
Thanks,
Monica
|
by: AshishMishra16 |
last post by:
HI friends,
I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for Struts:
import java.io.File;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
|
by: vijaykumardahiya |
last post by:
Hello To Every One,
I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic.
I read the FileUpload Home page.But I am still confused.
Is that true that file uploaded image can not show on servlet.Its store to database or memory..??
Please assist me.
Thanks.
|
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...
|
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...
| |
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,...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
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
| |
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...
| |