WeaKness Posted November 14, 2003 Posted November 14, 2003 Ok, here goes everyone, this is my first asp.net project and its for work /sigh so i could really use some help what i HAVE to do, have one page that authenticates the user (i dont care if its by and xcl sheet access db or by boobla boobla black magic :D ) then if the are a user pass the username to the next page as "techNum" (right now i have some dropdowns to select them but thats just so i could get my juices flowing) on the next page they will upload 16 jpgs (i think i have that part covered) AND on that page i need to make a form that will save an excel document in the same dir as all the jpgs, thats all, not much eh :D i have included the code i have written thus far for page 2 (which is just the form to upload the 16 jpgs) Please see if you have any improvements for it or any blatent errors p.s. be merciful its the first time i have dabbled at all in .net stuff at all, there is alot of whitespace right now as well, sorry <html> <head> <script language="VB" runat="server"> Sub Upload(Source As Object, e As EventArgs) Dim thisYear as String Dim thsMonth as string Dim thisDay as string thisYear = Now.Year thisMonth = Now.Month thisDay = Now.Day If Not (myFile1.PostedFile Is Nothing) Then myFile1.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\cover1.jpg") lblMsg1.Text = "Job 1 Coversheet Upload successfull." End If If Not (myFile2.PostedFile Is Nothing) Then myFile2.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\cover2.jpg") lblMsg2.Text = "Job 2 Coversheet Upload successfull." End If If Not (myFile3.PostedFile Is Nothing) Then myFile3.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\cover3.jpg") lblMsg3.Text = "Job 3 Coversheet Upload successfull." End If If Not (myFile4.PostedFile Is Nothing) Then myFile4.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\cover4.jpg") lblMsg4.Text = "Job 4 Coversheet Upload successfull." End If If Not (myFile5.PostedFile Is Nothing) Then myFile5.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J1QC1.jpg") lblMsg5.Text = "Job 1 QC 1 Upload successfull." End If If Not (myFile6.PostedFile Is Nothing) Then myFile6.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J1QC2.jpg") lblMsg6.Text = "Job 1 QC 2 Upload successfull." End If If Not (myFile7.PostedFile Is Nothing) Then myFile7.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J1QC3.jpg") lblMsg7.Text = "Job 1 QC 3 Upload successfull." End If If Not (myFile8.PostedFile Is Nothing) Then myFile8.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J2QC1.jpg") lblMsg8.Text = "Job 2 QC 1 Upload successfull." End If If Not (myFile9.PostedFile Is Nothing) Then myFile9.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J2QC2.jpg") lblMsg9.Text = "Job 2 QC 2 Upload successfull." End If If Not (myFile10.PostedFile Is Nothing) Then myFile10.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J2QC3.jpg") lblMsg10.Text = "Job 2 QC 3 Upload successfull." End If If Not (myFile11.PostedFile Is Nothing) Then myFile11.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J3QC1.jpg") lblMsg11.Text = "Job 3 QC 1 Upload successfull." End If If Not (myFile12.PostedFile Is Nothing) Then myFile12.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J3QC2.jpg") lblMsg12.Text = "Job 3 QC 2 Upload successfull." End If If Not (myFile13.PostedFile Is Nothing) Then myFile13.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J3QC3.jpg") lblMsg13.Text = "Job 3 QC 3 Upload successfull." End If If Not (myFile14.PostedFile Is Nothing) Then myFile14.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J4QC1.jpg") lblMsg14.Text = "Job 4 QC 1 Upload successfull." End If If Not (myFile15.PostedFile Is Nothing) Then myFile15.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J4QC2.jpg") lblMsg15.Text = "Job 4 QC 2 Upload successfull." End If If Not (myFile16.PostedFile Is Nothing) Then myFile16.PostedFile.SaveAs("c:\upload\" Region & "\" & Tech & "\" & thisYear & "\" & thisMonth & "\" & thisDay & "\J4QC3.jpg") lblMsg16.Text = "Job 4 QC 3 Upload successfull." End If End Sub </script> </head> <body> <h3>File Upload</h3> <form enctype="multipart/form-data" runat="server"> <select name="Region"> <option selected>Choose Region</option> <option value="Pocatello">Pocatello</option> <option value="Vegas">Las Vegas</option> </select> <br> <select name="Tech"> <option selected>Choose Tech</option> <option value="7300">7300</option> <option value="7301">7301</option> <option value="7302">7302</option> <option value="7303">7303</option> </select> <br> Coversheet Job 1: <input id="myFile1" type="File" runat="server"><br> Coversheet Job 2: <input id="myFile2" type="file" runat="server"><br> Coversheet Job 3: <input id="myFile3" type="file" runat="server"><br> Coversheet Job 4: <input id="myFile4" type="file" runat="server"><br> Job 1 QC 1 : <input id="myFile5" type="file" runat="server"><br> Job 1 QC 2: <input id="myFile6" type="file" runat="server"><br> Job 1 QC 3: <input id="myFile7" type="file" runat="server"><br> Job 2 QC 1: <input id="myFile8" type="file" runat="server"><br> Job 2 QC 2: <input id="myFile9" type="file" runat="server"><br> Job 2 QC 3: <input id="myFile10" type="file" runat="server"><br> Job 3 QC 1: <input id="myFile11" type="file" runat="server"><br> Job 3 QC 2: <input id="myFile12" type="file" runat="server"><br> Job 3 QC 3: <input id="myFile13" type="file" runat="server"><br> Job 4 QC 1: <input id="myFile14" type="file" runat="server"><br> Job 4 QC 2: <input id="myFile15" type="file" runat="server"><br> Job 4 QC 3: <input id="myFile16" type="file" runat="server"><br> <asp:label id=lblMsg1 runat="server" /> <asp:label id=lblMsg2 runat="server" /> <asp:label id=lblMsg3 runat="server" /> <asp:label id=lblMsg4 runat="server" /> <asp:label id=lblMsg5 runat="server" /> <asp:label id=lblMsg6 runat="server" /> <asp:label id=lblMsg7 runat="server" /> <asp:label id=lblMsg8 runat="server" /> <asp:label id=lblMsg9 runat="server" /> <asp:label id=lblMsg10 runat="server" /> <asp:label id=lblMsg11 runat="server" /> <asp:label id=lblMsg12 runat="server" /> <asp:label id=lblMsg13 runat="server" /> <asp:label id=lblMsg14 runat="server" /> <asp:label id=lblMsg15 runat="server" /> <asp:label id=lblMsg16 runat="server" /> <input type=button value="Upload" OnServerClick="Upload" runat="server"> </form> </body> </html> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.