|
|
#1 (permalink) |
|
New Member
![]() Join Date: Mar 2006
Posts: 4
|
Hi...I am a pre-newbie. I am completely unqualified to build a web site but have somehow found myself doing so anyway. I have no formal education and have taught myself what little I know. That being said (keeping in mind i know very little lingo) could anyone steer me in the right direction to find out how to incorporate the ability for users to upload images to a web site. My client offers a service to have pictures or artwork imprinted on a variety of products such as t-shirts, mugs, etc....and has been very successful doing so with customers just mailing in the pictures. She would like to offer the ability for users to upload those same images online. I have no clue how to do this. I am currently using frontpage. Can I do this on my own or is it a software package i need to buy or scripting I can add....or what? Please help!
|
|
|
|
|
|
#3 (permalink) |
|
New Member
![]() Join Date: Mar 2006
Posts: 4
|
Thanks for responding...The server which hosts the web site is Network Solutions. They offer the following info....
Network Solutions supports the following scripting languages and versions: n PERL o Perl for Unix v. 5.85 o ActivePerl v. 5.6.1 n JavaScript n ASP n PHP v. 4 n ASP Net n Cold Fusion MX |
|
|
|
|
|
#4 (permalink) |
|
Bronze Member
![]() |
This isn't the cleanest solution, but it works. Copy the below and paste it in a file called upload.asp in the root of your web server.
================================================== ========== <% if request("upload") = "now" then Server.ScriptTimeout=1000 ForWriting = 2 adLongVarChar = 201 lngNumberUploaded = 0 On Error Resume Next noBytes = Request.TotalBytes binData = Request.BinaryRead (noBytes) Set RST = CreateObject("ADODB.Recordset") LenBinary = LenB(binData) strDataWhole = LenB(binData) if LenBinary > 0 Then RST.Fields.Append "myBinary", adLongVarChar, LenBinary RST.Open RST.AddNew RST("myBinary").AppendChunk BinData RST.Update strDataWhole = RST("myBinary") End if strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE") lngBoundryPos = instr(1,strBoundry,"boundary=") + 8 strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos) Set dPassword = ParseForm("Password") Set dOptions = ParseForm("Options") Response.Write ParseForm("Password").item(0) & "" Response.write dPassword.item(0) & "" response.Write ParseForm("TArea").item(0) & "" SavePath = Server.MapPath("/") & "\" intCount = dOptions.count if intCount > 0 Then For x = 0 To intCount Select Case dOptions.item(x) Case "Raw" Raw = True Case "Boundry" Boundry = True End Select Next Else Raw = False Boundry = False End if if Raw Then Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(SavePath & "\raw.txt", ForWriting, True) f.Write strDataWhole Set f = nothing Set fso = nothing End if lngCurrentBegin = instr(1,strDataWhole,strBoundry) lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1 countloop = 0 Do While lngCurrentEnd > 0 strData = mid(strDataWhole,lngCurrentBegin, (lngCurrentEnd - lngCurrentBegin) + 1) lngBeginFileName = instr(1,strdata,"filename=") + 10 lngEndFileName = instr(lngBeginFileName,strData,chr(34)) if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then Response.Write "<H2> The following Error occured.</H2>" Response.Write "You must Select at least one file To upload, and it must be in order from the top form." Response.Write "<BR><BR>Hit the back button, make the needed corrections and resubmit your information." response.Write "<BR><BR><INPUT type='button' onclick='history.go(-1)' value='<< Back' id='button'1 name='button'1>" Response.End End if if lngBeginFileName <> lngEndFileName and lngBeginFileName - 10 <> 0 Then strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName) if Boundry Then Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(SavePath & "\raw_" & lngNumberUploaded & ".txt", ForWriting, True) f.Write strData Set f = nothing Set fso = nothing End if tmpLng = instr(1,strFilename,"\") Do While tmpLng > 0 PrevPos = tmpLng tmpLng = instr(PrevPos + 1,strFilename,"\") Loop FileName = right(strFilename,len(strFileName) - PrevPos) ' --------------------------------------------------------------------------------------------------------------------- Set fso = CreateObject("Scripting.FileSystemObject") if fso.FileExists(SavePath & "\" & FileName) then %> <b><%=FileName%></b> already exists!<br><br> Hit the back button, make the needed corrections and resubmit your information.<br><br> <input type='button' onclick='history.go(-1)' value='<< Back' id='button'1 name='button'1> <% Set fso = nothing Response.End end if Set fso = nothing ' --------------------------------------------------------------------------------------------------------------------- str_type = right(FileName,4) if str_type = "tiff" or str_type = ".mpg" or str_type = "mpeg" or str_type = ".avi" or str_type = ".mov" or str_type = ".eps" then %> <b><%=str_type%></b> format is not permitted!<br><br> Hit the back button, make the needed corrections and resubmit your information.<br><br> <input type='button' onclick='history.go(-1)' value='<< Back' id='button'1 name='button'1> <% Response.End end if ' --------------------------------------------------------------------------------------------------------------------- lngCT = instr(1,strData,"Content-Type:") if lngCT > 0 Then lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4 Else lngBeginPos = lngEndFileName End if lngEndPos = len(strData) lngDataLenth = (lngEndPos - lngBeginPos) -1 strFileData = mid(strData,lngBeginPos,lngDataLenth) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(SavePath & "\" & FileName, ForWriting, True) f.Write strFileData Set f = nothing Set fso = nothing lngNumberUploaded = lngNumberUploaded + 1 End if lngCurrentBegin = lngCurrentEnd lngCurrentEnd = instr(lngCurrentBegin + 9 ,strDataWhole,strBoundry) - 1 countloop = countloop + 1 if countloop = 100 Then Response.Write "looped 100 times terminating script!" if rstLog.State Then rstLog.close if conn.State Then conn.Close Response.End End if loop if rstLog.State Then rstLog.close if conn.State Then conn.Close response.redirect("upload.asp") response.end() end if ' ---------------------------------------------------------------------------------------------------- %> Upload images through this form. <form enctype="multipart/form-data" action="upload.asp?upload=now" method="post" id="form1" name="form1"> <input name="File1" size="60" type="file"><br> <br> <input type="submit" class="button" value="Upload now!"> </form> |
|
|
|
|
|
#8 (permalink) |
|
Silver Member
![]() Join Date: Oct 2005
Location: DE
Posts: 231
|
open a new notepad document, paste the above code. choose, file, save as. change the file type to all, name your file upload.asp upload to your root directory
__________________
| ISDProductions.com | TechnologyTutorials.org | DesignYourMySpace.com | Spore | | MySpace Design Forum | |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|