Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 December 7th, 2012, 03:08 PM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default System.IO.Path Won't work

hello

this class : system.io.path won't work , i've set every thing right and it was working right , but now i dont know whats going on !

string extention = System.IO.Path.GetExtension(FileUpload1.FileName);

FileUpload1.SaveAs
(System.IO.Path.Combine(physicalFolder, fileName+extention));

it returns empty extention and dosen't save any thing .
could u help me ? thanks alot
 
Old December 8th, 2012, 02:21 AM
Authorized User
 
Join Date: Nov 2012
Posts: 40
Thanks: 8
Thanked 5 Times in 4 Posts
Default

Hi,

To check wether if the error is not on you part why dont you try the source code that comes with the book, that way you are easily going to know if the fault is within your code/project or permissions issue.

For me the code in the book was working.

Last edited by 07Raghav; December 8th, 2012 at 02:26 AM..
The Following User Says Thank You to 07Raghav For This Useful Post:
kafshdoozak (December 25th, 2012)
 
Old December 9th, 2012, 07:37 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In addition to what 07Raghav is saying, you may also want to debug your code (see chapter 18) and see what data the FileUpload contains. Are you sure it contains a valid uploaded file? And does the file have an extension? Also, are you using the code from the book as-is or is this your own code? Are you maybe using an UpdatePanel around your FileUpload?

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!
The Following User Says Thank You to Imar For This Useful Post:
kafshdoozak (December 25th, 2012)
 
Old December 25th, 2012, 08:16 AM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Thank you 07Raghav and Imar

the problem is made by UpdatePanle , i removed it and now its ok but i don't want to post entire page to server just for inserting or updating , what can i do ?
 
Old December 26th, 2012, 09:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, that explains it. FileUploads inside an UpdatePanel are known to cause issues. Take a look here: http://stackoverflow.com/questions/3...the-whole-page or search Google for FileUpload UpdatePanel.

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!
 
Old December 26th, 2012, 10:22 AM
Authorized User
 
Join Date: Aug 2012
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Oh , sorry i didn't know that thanks alot





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
Reflection -:System.IO.FileNotFoundExc,3rd edition kal2na2 BOOK: Professional C#, 2nd and 3rd Editions 0 February 10th, 2006 01:13 AM
Reflection -VectorClass :System.IO.FileNotFoundExc kal2na2 C# 1 February 9th, 2006 10:10 AM
System.IO.FileNotFoundException cuca_macaii2000 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 5th, 2005 10:10 AM
Parameter value as node path, doesn't work scubaduba XSLT 2 November 6th, 2004 02:15 PM





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