Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Reply
 
LinkBack Thread Tools Display Modes
Old 03-20-2006, 01:33 PM   #1 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 4
Default user ability to upload images

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!
missjean is offline   Reply With Quote
Old 03-20-2006, 02:08 PM   #2 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

Do you know what technology your web site can serve up? Asp, Php, Cold Fusion, Java, anything? You'll need to know this to know what script to use. The script you're looking for is fairly common.
thrive is offline   Reply With Quote
Old 03-20-2006, 04:27 PM   #3 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 4
Default scripting languages

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
missjean is offline   Reply With Quote
Old 03-20-2006, 04:46 PM   #4 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

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>
thrive is offline   Reply With Quote
Old 03-20-2006, 05:03 PM   #5 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 4
Default

I do not see an upload.asp folder in the root directory. these are all I found:

backup
cgi-bin
htdocs
public_html
missjean is offline   Reply With Quote
Old 03-20-2006, 05:08 PM   #6 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default

create a new file called upload.asp and paste what I put in the comment above into it. place that file in the public_html folder. then go to your site /upload.asp to use it
thrive is offline   Reply With Quote
Old 03-20-2006, 11:43 PM   #7 (permalink)
New Member
 
Join Date: Mar 2006
Posts: 4
Default

This is frustrating...I went to the file manager...pasted the info you supplied me into a new file which I named upload.asp and.....this is the message I got:

Can not open file: upload.asp

yikes...what am I doing wrong.
missjean is offline   Reply With Quote
Old 03-21-2006, 01:16 PM   #8 (permalink)
Silver Member
 
ISDProductions's Avatar
 
Join Date: Oct 2005
Location: DE
Posts: 231
Default

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 is offline   Reply With Quote
Old 03-22-2006, 03:15 PM   #9 (permalink)
Bronze Member
 
thrive's Avatar
 
Join Date: Mar 2006
Location: Ottawa, Canada
Posts: 66
Send a message via MSN to thrive
Default Contact me

MSN me at thriveca at hotmail.com
thrive is offline   Reply With Quote
Old 03-22-2006, 04:36 PM   #10 (permalink)
Diamond Member
 
StephanieCordray's Avatar
 
Join Date: Dec 2004
Location: Nashville TN
Posts: 1,017
Send a message via ICQ to StephanieCordray Send a message via MSN to StephanieCordray
Default

why not try an image gallery such as Gallery? Users can register and you can specify who has upload permissions from the admin control. That way you can sort of police the site and make sure only what you want to allow is allowed.
StephanieCordray is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:35 AM.


Computer Forum - Internet Business - Webpage Design

 
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.