<%@ Language=VBScript %> <% Server.ScriptTimeOut = 2500 emailmeonsub = true ' set these to false usually diagnostics = false allowany = false if fmembersonly then checksecurity pagecat = "SUBMIT" Response.Buffer = True dim maxfilesize maxfilesize = 11000000 '**http://www.stardeveloper.com/articles/display.html?article=2001042501&page=1 dim sartistval, stitleval, sdescval, scatval sartistval = "" stitleval = "" sdescval = "" scatval = "--" public sub savefile sartistval = load.getFileData("sartist") stitleval = load.getFileData("stitle") sdescval = load.getFileData("sdesc") scatval = load.getFileData("scat") dim returnerror, jpg returnerror = "" jpg = false ' load object ' Dim load ' Set load = new Loader ' calling initialize method ' load.initialize ' File binary data Dim fileData, filedata2 fileData = load.getFileData("file") filedata2 = load.getFileData("jpgfile") if load.getFileSize("jpgfile") > 100 then jpg = true ' File name Dim fileName, origFileName ' this is the original file name but we are going to change it to the date and time submitted origFileName = load.getFileName("file") filename = DatePart("M", Date) & "-" & DatePart("D", Date) & "-" & DatePart("YYYY", Date) & "-" & DatePart("H", time) & "-" & DatePart("n", time) & "-" & DatePart("s", time) Dim contentType contentType = load.getContentType("file") jpgcontentType = load.getContentType("jpgfile") Dim fileExt fileExt = LCase(load.getFileExt("file")) if len(fileExt) <> 0 then fileExt = "." & fileExt ' File path Dim filePath filePath = load.getFilePath("file") ' File path complete Dim filePathComplete filePathComplete = load.getFilePathComplete("file") ' File size Dim fileSize fileSize = load.getFileSize("file") ' File size translated Dim fileSizeTranslated fileSizeTranslated = load.getFileSizeTranslated("file") ' Content Type 'check to make sure the audio/video file is an allowed type. dim allowedTypes allowedTypes = "image/jpeg, image/pjpeg, image/gif, video/quicktime, video/mpeg, video/x-mpeg, video/x-ms-wmv, video/mp4, audio/mp4, audio/mpeg, audio/mpeg3, audio/x-mpeg-3, application/x-shockwave-flash, audio/x-pn-realaudio, video/vnd.rn-realvideo" allowedTypes = " " & allowedTypes & "," if instr(allowedTypes, " " & lcase(contentType) & ",") = 0 and allowany = false then returnerror = "I'm sorry, '" & origFileName & "' does not appear to be one of our accepted file types!" ' & contentType end if ' check to make sure that they are not submitting 2 jpegs (should be one jpg or 1 video/audio and 1 jpg) if jpg and (contenttype = "image/pjpeg" or contenttype = "image/jpeg" or contenttype = "image/gif") then returnerror = "I'm sorry, you cannot submit a second sill image if your media is an image!" 'check the still image, and add its extension if jpg and ((jpgcontenttype = "image/pjpeg") or (jpgcontenttype = "image/jpeg")) then imgfilename = filename & "T.jpg" elseif jpg and (jpgcontenttype = "image/gif") then imgfilename = filename & "T.gif" elseif jpg then returnerror = "I'm sorry, your still image does not appear to be a valid jpg or gif file!" '& jpgcontenttype end if ' No. of Form elements Dim countElements countElements = load.Count ' Value of text input field "name" Dim nameInput nameInput = load.getValue("stitle") ' Path where file will be uploaded Dim pathToFile pathToFile = Server.mapPath("submitbin/") ' Uploading file data Dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") dim filenocount, tempfilename filenocount = 0 tempfilename = filename do while fso.fileexists(pathToFile & "/" & filename & fileExt) filename = tempfilename filenocount= filenocount + 1 fileName = fileName & "_" & cstr(filenocount) loop fileName = fileName & fileExt dim errorz errorz = true if returnerror = "" then if load.saveToFile("file", pathToFile & "/" & fileName) then errorz = false if jpg then if not load.saveToFile("jpgfile", pathToFile & "/" & imgfilename) then errorz = true end if end if if not errorz then dim objConn ' Our Connection Object dim objRS1 ' Our Recordset Object dim strSQL ' Our SQL string to access the database Set objConn = CreateObject("ADODB.Connection") Set objRS1 = CreateObject("ADODB.Recordset") objConn.Open ConnStr strSQL = "INSERT INTO submissions (uid, subdate , filename , imgfilename, artist, title, description, " strSQL = strSQL & "category, filetype, size) VALUES (" strSQL = strSQL & "'" & session("memberuid") & "'," strSQL = strSQL & "NOW(), " strSQL = strSQL & "'" & fileName & "', " if jpg then strSQL = strSQL & "'" & imgfilename & "', " else strSQL = strSQL & "'', " end if strSQL = strSQL & "'" & replace(replace(load.getValue("sartist"), "'", "'"), "%34", """) & "', " strSQL = strSQL & "'" & replace(replace(load.getValue("stitle"), "'", "'"), "%34", """) & "', " strSQL = strSQL & "'" & replace(replace(load.getValue("sdesc"), "'", "'"), "%34", """) & "', " strSQL = strSQL & "'" & load.getValue("scat") & "', " strSQL = strSQL & "'" & contentType & "', " strSQL = strSQL & "'" & fileSize & "')" 'response.write strSQL set objRS1 = objConn.Execute(strSQL) objConn.Close if diagnostics then %>
File Name<%= fileName %>
File Path<%= filePath %>
File Path Complete<%= filePathComplete %>
File Size<%= fileSize %>
File Size Translated<%= fileSizeTranslated %>
Content Type<%= contentType %>
Title<%= nameInput %>


<% end if if emailmeonsub and Request.ServerVariables("server_name") <> testservername then Set objSendMail = server.CreateObject("CDONTS.NewMail") With objSendMail .From = "server@filmboston.com" .To = "alert@filmboston.com" ' .Cc = objRS1("email2").value .Bcc = "" .Subject = "VisualBoston: Content Submitted!!!" .Body = "http://www.visualboston.com/dbase/admin.asp" .Send End With Set objSendMail = Nothing end if %> <% if not diagnostics then response.redirect "login.asp?actmsg=" & EncodeMe("Files Uploaded Sucessfully (remember: files are reviewed before posting)") else if diagnostics then %>
File Name<%= fileName %>
File Path<%= filePath %>
File Path Complete<%= filePathComplete %>
File Size<%= fileSize %>
File Size Translated<%= fileSizeTranslated %>
Content Type<%= contentType %>
Title<%= nameInput %>


<% end if if returnerror = "" then Response.Write "File could not be uploaded..." Response.Write "
" OutputForm() else Response.write "" & returnerror & "
" OutputForm() end if %> <% 'delete file in case it got saved anyway end if ' destroying load object Set load = Nothing end sub function OutputForm() dim counter, es,ee,i,myarray() set es=Server.CreateObject("Scripting.FileSystemObject") set ee=es.OpenTextFile(Server.MapPath("fblog.txt"),1,false) do while ee.ReadLine <> "*categories" loop i = 0 do ReDim Preserve myarray(i+1) myarray(i) = ee.ReadLine i = i + 1 loop while (myarray(i-1) <> "x") ee.close %>
Submissions are best kept under 5 to 7 minutes, and file size must be less than <%=maxfilesize/1000000%> MB. We accept submissions based on our perception of quality, and our current needs (which change daily). Please give us time to respond, and please do not be insulted if we can't use it!
*Producer's Name: 
*Submission Title: 
*Category:
*File:
JPG or GIF Still:
*Description: 
<% end function %> <% if Request.ServerVariables("REQUEST_METHOD") <> "POST" then OutputForm() else Dim load Set load = new Loader ' calling initialize method load.initialize if maxfilesize < request.totalBytes then response.write "File Too Big!
" else SaveFile response.write "
" end if end if %>