Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2009, 04:32 AM
Friend of Wrox
 
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
Arrow uploading multiple file types ........

Hello sir,
Well I have 1 more problem

As in chapter 13:Linq when dealing with uploading files related to issue "Please upload valid .jpg file" .The code that you suggested is as below
Code:
protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e)
	{
		FileUpload FileUpload1 = (FileUpload)ListView1.InsertItem.FindControl("FileUpload1");
		if (!FileUpload1.HasFile || !FileUpload1.FileName.ToLower().EndsWith(".jpg"))
		{
			CustomValidator CustomValidator1 =
								 (CustomValidator)ListView1.InsertItem.FindControl("CustomValidator1");
			CustomValidator1.IsValid = false;
			e.Cancel = true;
		}
	}
Quote:
If i try to modify this code to accept multiple file types like .jpeg , .gif etc. then it does not work and this code seems to be unmodifiable. I have also tried the if - else if constraint, but it does not work.
So how multiple file types can be attached with the single FileUpload control.
But it should not accept any .txt , .doc or any other document file.
However there would be only one file at a time but what I wish is that it supports multiple file types.
 
Old September 25th, 2009, 04:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Please use Quotes only when you quote other people's text; not for your own text. Looks very confusing
Quote:
and this code seems to be unmodifiable
Heuh? You can simply modify it in the editor. You can add an extra expression for other types. E.g.:

FileUpload1.FileName.ToLower().EndsWith(".jpg") ||
FileUpload1.FileName.ToLower().EndsWith(".gif"))

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old September 25th, 2009, 05:18 AM
Friend of Wrox
 
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
Arrow function not working

Yes it seems easy but it is getting me problem. I have tried the code in both of the fashions like

Code:
if (!FileUpload1.HasFile || !FileUpload1.FileName.ToLower().EndsWith(".jpg")
            || !FileUpload1.FileName.ToLower().EndsWith(".gif"))
and

Code:
if (!FileUpload1.HasFile || FileUpload1.FileName.ToLower().EndsWith(".jpg") 
           || FileUpload1.FileName.ToLower().EndsWith(".gif"))
But always the code inside the if statement runs when I try to upload a .gif file...
 
Old September 25th, 2009, 05:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're forgetting the ! operator. Also you need to combine the two file types. E.g.:

if (!FileUpload1.HasFile || (!FileUpload1.FileName.ToLower().EndsWith(".jpg")
&& !FileUpload1.FileName.ToLower().EndsWith(".gif")))
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
jack_hilary (September 25th, 2009)
 
Old September 25th, 2009, 05:58 AM
Friend of Wrox
 
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
Arrow Thank you.......

How stupid I am, I have been dealing in C, C++ and Java for last 3 years but I could not guess about && operator. Thanks for that.

Now Please tell me ,the most important thing for me. As you about your site PlanetWrox.com there is session about gig pics. It deals with images and description and tooltips etc. Now can it be modified to provide the link like "Buy" to the end user and on clicking it the product detail is stored in the billing information and on completion the email is sent to the email address of the user about the product so that it becomes like e commerce.

I am still working on CreateUserWizard as it seems to be hard working with it on email issue.

once again thanks for last reply
 
Old September 25th, 2009, 05:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Ecommerce is too big a topic to explain over a few simple posts. My advice, as in other replies, is to get a book (or multiple books) on the topic. My Instant Results book shows you the basic steps, but you'll find many other books on eCom at your favorite book store / site.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Image Uploading? courtney_ctisn Classic ASP Basics 0 October 12th, 2007 05:35 AM
Filter File Types in ASP.NET File Upload ramuis78 ASP.NET 2.0 Basics 2 May 31st, 2007 10:50 AM
Uploading multiple images Adam H-W Classic ASP Basics 0 April 26th, 2007 04:18 AM
Please help me!!!How can I recognize file types tqbinh C# 1 August 13th, 2004 09:45 AM
uploading different file types lanita PHP How-To 2 July 25th, 2004 11:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.