Author Archive
My cousins and I attended Saturday’s Red Sox @ Orioles contest and then Today’s Twins @ Red Sox game… here’s some of my favorite pictures from the games (all Pics are here):
Since this is not available yet on the jQuery home page, here is a way to get the file as it stands today:
1) Download MVC 2 Realease Canditate 2 from here (file name: AspNetMVC2_RC2_VS2008.exe)
2) Copy this file to somewhere “easy” to use with a DOS Prompt, I copied AspNetMVC2_RC2_VS2008.exe to “C:\Temp\MVC2RC2\”
3) Use a program like 7-zip or WinRar to extract the .exe to this folder using the “Extract Here” option (screenshot)
4) Open up a command prompt and type to get to this folder created by the extraction:
cd "C:\Temp\MVC2RC2\mvctoolsvs2008"
5) Type this MS DOS command (referenced from this blog post), when it’s complete, close the command window:
msiexec /a vs2008toolsmvc2.msi /qb TARGETDIR=C:\Temp\MVC2RC2\Extract
6) Back in windows explorer, you should be able to navigate to “C:\Temp\MVC2RC2\Extract\Microsoft ASP.NET\ASP.NET MVC 2\VisualStudio_PROJ_DIR\CSharp\Web\1033″, where there is a zip file named “EmptyMvcWebApplicationProjectTemplatev2.0.cs.zip”
7) Inside that zip file is “scripts/jquery-1.4.1-vsdoc.js”….
Enjoy!
So went up early Sunday morning, Feb 7th, to watch the Space Shuttle Endeavor to go up to the International Space Station, only to have the launch postponed due to low cloud cover. They don’t affect the launch, but they do become a problem in case the Shuttle had to make an emergency landing there. Anyways, despite the lack of launch, I got a few nice pictures
Hopefully I’ll get some time to get back up to Titusville for one of the final 4 launches of the Shuttle Program. Having the ability to see one of these in person is really a great benefit of living in Florida
So it took me forever to get it put together, but it finally paid off! Today I received from Apple my iPhoto-generated hard cover photo book of my Alaska trip in June… I thought I would share what it looks like some
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Total time to put together: many hours (but it’s fun to do)
Total cost: $52 shipped
I look forward to getting books together for my previous trips to Europe and China, I can’t wait to share!
So now that the iPhone thinks that Google Apps (link) is an Exchange server and does a fantastic job of syncing/pushing Contacts/Calendars, it’s time to ditch that $99 MobileMe account……
Looking to easily move my contacts from MobileMe directly into Google Apps, I ran across the Mac OSX app “Address Book to CSV Exporter” (link), what a fantastic app! It yanked all my contacts into a CSV that Apps picked right up…..
This was the third program I ran across to do this task btw, but the first one that didn’t require me to install “Rosetta” on my MacBook Air
Win !!!
So musing around the internet for an ASP.NET example of using this excellent multiple file plugin, I couldn’t find a good simple example to work off, so I spent the half hour and did it myself and thought I’d share….
So let’s get right to the point, let me show the code!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Dim AllowedFileTypes As Dictionary(Of String, String) Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) AllowedFileTypes = New Dictionary(Of String, String) AllowedFileTypes.Add("gif", "image/gif") AllowedFileTypes.Add("jpg", "image/jpeg,image/jpeg,image/pjpeg") AllowedFileTypes.Add("png", "image/png") AllowedFileTypes.Add("zip", _ "application/octet-stream,application/x-zip-compressed") AllowedFileTypes.Add("rar", "application/octet-stream") AllowedFileTypes.Add("html", "text/html") AllowedFileTypes.Add("htm", "text/html") AllowedFileTypes.Add("txt", "text/plain") AllowedFileTypes.Add("js", "text/javascript") AllowedFileTypes.Add("css", "text/css") End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Message.InnerHtml = String.Empty Dim FileInputClass As String = String.Empty For Each FileType As String In AllowedFileTypes.Keys FileInputClass &= String.Concat(FileType, "|") Next If Not String.IsNullOrEmpty(FileInputClass) Then File1.Attributes.Add("accept", _ FileInputClass.Substring(0, FileInputClass.Length - 1)) End If End Sub Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Make sure Windows User "NETWORK SERVICE" has write permissions! Dim SaveFolder As String = "C:\Temp\Uploads\" Message.InnerHtml = String.Empty Dim AllFiles As HttpFileCollection = Request.Files Dim ThisFile As HttpPostedFile, ValidType As Boolean, ThisFileName As String For i As Int32 = 0 To (AllFiles.Count - 1) ThisFile = AllFiles.Get(i) If ThisFile.ContentLength > 0 Then ThisFileName = IO.Path.GetFileName(ThisFile.FileName) ValidType = False For Each FileTypeList As String In AllowedFileTypes.Values() For Each FileType As String In FileTypeList.Split(CChar(",")) If FileType.ToLower().Equals(ThisFile.ContentType.ToLower()) Then ValidType = True Exit For End If Next If (ValidType = True) Then Exit For Next If ValidType = True Then Try ThisFile.SaveAs(String.Concat(SaveFolder, ThisFileName)) Message.InnerHtml &= _ String.Format("{0} saved<br />", ThisFileName) Catch ex As Exception Message.InnerHtml &= _ String.Format("{0}: <b>{1}</b><br /> _ ThisFileName, ex.Message) End Try Else Message.InnerHtml &= _ String.Format("<b>{0}: Invalid File Type of {1}</b><br />", _ ThisFileName, ThisFile.ContentType) End If End If Next End Sub Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Message.Visible = Not String.IsNullOrEmpty(Message.InnerHtml) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>jQuery Multi Upload with ASP.NET</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script src="http://www.fyneworks.com/jquery/multiple-file-upload/jquery.blockUI.js" type="text/javascript"></script> <script src="http://jquery-multifile-plugin.googlecode.com/svn/trunk/jquery.MultiFile.js" type="text/javascript"></script> <script src="http://www.fyneworks.com/jquery/multiple-file-upload/jquery.MetaData.js" type="text/javascript"></script> <style type="text/css"> body { font-size: 10px; font-family: Verdana; } #Link { padding-bottom: 10px; } #Message { padding: 4px; background-color: #dadada; border: solid 1px red; } </style> </head> <body> <form id="form1" runat="server" enctype="multipart/form-data"> <div> <div id="Link">And example of using the jQuery plugin <a href="http://www.fyneworks.com/jquery/multiple-file-upload/" target="_blank">"jQuery Multiple File Upload Plugin"</a> with ASP.NET</div> <div id="Message" runat="server" visible="false"></div> <div><input id="File1" type="file" name="File1" runat="server" class="multi" /></div> <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" /> </div> </form> </body> </html> |
The MIME stuff is tricky as different browsers use different types for certain file types, for example, zip files uploaded via FireFox are “octet-stream” and IE uses “application/x-zip-compressed”…
Anyways, hopefully this helps give you an idea of what to start with if you want to give your site users the ability to upload multiple files at once in your ASP.NET application








