 |
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
|
|
|
|
|

September 25th, 2009, 04:32 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
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.
|
|
|

September 25th, 2009, 04:54 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

September 25th, 2009, 05:18 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
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...
|
|

September 25th, 2009, 05:22 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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")))
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

September 25th, 2009, 05:58 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
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
|
|

September 25th, 2009, 05:44 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |