Important alert: (current site time 7/15/2013 10:06:09 PM EDT)
 

The /strong is wrong... Bye and thanx a lot
(If this comment was disrespectful, please report it.)

 
VB icon

Form Based File Upload Using Pure ASP

Email
Submitted on: 4/2/2001 9:45:09 PM
By: Karl P. Grear 
Level: Advanced
User Rating: By 91 Users
Compatibility: ASP (Active Server Pages)
Views: 194269
author picture
(About the author)
 
     This code will allow you to do form based file uploads. It supports multiple files and uses only pure ASP. It will parse form data, browse server folders for a save location, and log uploads or failed uploads into a database There are no components to install so it will work on any web server that supports ASP. Just paste this code into a text file and name it saveany.asp. I have tested it on IIS 4 and 5, with IE 4, IE 5 and Netscape 6. With this code you will be able to save a file in any directory that the anonymous account assigned to it (usually IUSER_machinename) has access to so be careful. I should note that the server needs ADO, ADOX and the File System Object installed on it.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Form Based File Upload Using Pure ASP
' Description:<b>This code will allow you to do form based file uploads</b>. It supports multiple files and uses only pure ASP. It will parse form data, browse server folders for a save location, and log uploads or failed uploads into a database There are no components to install so it will work on any web server that supports ASP. Just paste this code into a text file and name it saveany.asp. I have tested it on IIS 4 and 5, with IE 4, IE 5 and Netscape 6. With this code you will be able to save a file in any directory that the anonymous account assigned to it (usually IUSER_machinename) has access to so be careful. I should note that the server needs ADO, ADOX and the File System Object installed on it.
' By: Karl P. Grear
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6569&lngWId=4'for details.'**************************************

<%response.buffer=false
Func = Request("Func")
if isempty(Func) Then
	Func = 1
End if
Select Case Func
Case 1
'You do not need to use this form to 
'send your files.
BrowseServer = Request.Form("BrowseServer")
%>
<H2>File Upload Form.</H2>
	
	<TABLE>
	
	
		<FORM ENCTYPE="multipart/form-data" ACTION="saveany.asp?func=2" METHOD=POST id=form1 name=form1>
		<TR><TD><STRONG>Debug Options.</STRONG><BR></TD></TR>
	<TR><TD><INPUT NAME=Options TYPE=CheckBox Value='Raw'>Create Raw File<BR></TD></TR>
		<TR><TD><INPUT NAME=Options TYPE=CheckBox Value='Boundry'>Create Boundry File<BR><BR></TD></TR>
		
		<TR><TD><STRONG>Hit the [Browse Server] button to find the folder on the server to upload to.</STRONG><BR></TD></TR>
		<TR><TD><INPUT NAME=ServerPath SIZE=30 TYPE=Text value='<%= BrowseServer %>'><INPUT type=button value="Browse Server" onclick="document.location='saveany.asp?func=3'" id=button1 name=button1><BR><BR></TD></TR>
		
		<TR><TD><STRONG>Hit the [Browse] button to find the file on your computer.</STRONG><BR></TD></TR>
		<TR><TD><INPUT NAME=File1 SIZE=30 TYPE=file><BR></TD></TR>
		<TR><TD><INPUT NAME=File2 SIZE=30 TYPE=file><BR></TD></TR>
		<TR><TD><INPUT NAME=File3 SIZE=30 TYPE=file><BR><BR></TD></TR>
		<TR><TD><STRONG>Enter security password.<STRONG><BR></TD></TR>
		<TR><TD><INPUT NAME=Password SIZE=30 TYPE=Text><BR></TD></TR>
		<TR><TD><STRONG>Comments<STRONG><BR></TD></TR>
		<TR><TD><textarea name=TArea cols=35 rows=5>Enter Comments Here</textarea><BR></TD></TR>
		<TR><TD align=left><INPUT name=submit type="submit" value="Upload File"><BR><BR></TD></TR>
		<TR><TD>NOTE: Please be patient, you will not receive any notification until the file is completely transferred.<BR><BR></TD></TR>
		</FORM>
	</TABLE>
<%
Case 2
Server.ScriptTimeout=300
ForWriting = 2
	adLongVarChar = 201
	lngNumberUploaded = 0
	
'Create a database connection
	set conn = server.createobject("adodb.connection")
'Create a recordset 
		Set rstLog = server.createobject("adodb.recordset")
		
		on error resume next
	'Open the connection
		conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\UploadLog.mdb;Persist Security Info=False"
		if err.number = "-2147467259" then
			'the database is missing create it
			CreateDatabase 
			Response.Write "Create Database"
			'reopen the connetion
			conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\UploadLog.mdb;Persist Security Info=False"
			err.clear	
		end if
		
	'Open recordset
		rstLog.Open "Select * from Logs", conn, 3, 3, 1	
		
'Get binary data from form		
	noBytes = Request.TotalBytes 
	binData = Request.BinaryRead (noBytes)
	
'convery the binary data to a string
	Set RST = CreateObject("ADODB.Recordset")
	LenBinary = 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
	
	
	'get the boundry indicator
		strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE")
		lngBoundryPos = instr(1,strBoundry,"boundary=") + 8 
		strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos)
	
	'ParseForm returns a dictionary object
	'You can ParseForm any time after the
	'Boundry indicator is set.
	
	Set dPassword = ParseForm("Password") 
	Set dOptions = ParseForm("Options")
		
		'both of these are valid	
		Response.Write ParseForm("Password").item(0) & "<BR>"
		Response.write dPassword.item(0) & "<BR>"
		
		'Just write the data in the TArea
		response.Write ParseForm("TArea").item(0) & "<br>"
		
		SavePath = ParseForm("ServerPath").item(0)
		if SavePath = "" or isempty(SavePath) Then
			Response.Write "<H2> The following Error occured.</H2>"
		Response.Write "You did Not enter a server path To save your file to."
		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
		
		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 dPassword.item(0) <> "oktosend" Then
		'Log invalid attempt to log file.
			rstLog.AddNew 
		'Log the date and time, the IP, the Path	
			rstLog(0) = Now()
			rstLog(1) = request.ServerVariables("REMOTE_ADDR")
			rstLog(2) = SavePath
			rstLog(3) = "Invalid Logon"
			
			rstLog.Update 
			
			Response.Write "<H2> The following Error occured.</H2>"
			Response.Write "The Password you entered is invalid."
			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
	'Creates a raw data file For With all 
'data sent. Uncomment for debuging.
		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
		
'Get first file boundry positions.
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
	
	
	
countloop = 0
		
Do While lngCurrentEnd > 0
'Get the data between current boundry 
'and remove it from the whole.
strData = mid(strDataWhole,lngCurrentBegin, (lngCurrentEnd - lngCurrentBegin) + 1)
'Remove the file data from the whole	
		'strDataWhole = replace(strDataWhole,strData,"")
		
				
'Get the full path of the current file.
	lngBeginFileName = instr(1,strdata,"filename=") + 10
	lngEndFileName = instr(lngBeginFileName,strData,chr(34)) 
'Make sure they selected at least one 
'file.	
	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"
			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
'There could be one or more empty file b
' 
' oxes.	
	if lngBeginFileName <> lngEndFileName and lngBeginFileName - 10 <> 0 Then
		strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
'Creates a raw data file with data 
'between current boundrys. Uncomment 
'for debuging.
		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
	
'Loose the path information and keep 
'just the file name.	
		tmpLng = instr(1,strFilename,"\")
		Do While tmpLng > 0
			PrevPos = tmpLng
			tmpLng = instr(PrevPos + 1,strFilename,"\")
		Loop
		
		FileName = right(strFilename,len(strFileName) - PrevPos)
	
'Get the begining position of the file 
'data sent.
'if the file type is registered with 
'the browser then there will be a 
'Content-Type
		lngCT = instr(1,strData,"Content-Type:")
	
		if lngCT > 0 Then
			lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
		Else
			lngBeginPos = lngEndFileName
		End if
'Get the ending position of the file 
'data sent.
		lngEndPos = len(strData) 
		
'Calculate the file size.	
		lngDataLenth = (lngEndPos - lngBeginPos) -1
'Get the file data	
		strFileData = mid(strData,lngBeginPos,lngDataLenth)
'Create the file.	
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set f = fso.OpenTextFile(SavePath & "\" & FileName, ForWriting, True)
		f.Write strFileData
		Set f = nothing
		Set fso = nothing
		
		'Log Upload Informatoin.
			rstLog.AddNew 
			'Log the date and time, the IP, the Path, and the Filename
				rstLog(0) = Now()
				rstLog(1) = request.ServerVariables("REMOTE_ADDR")
				rstLog(2) = SavePath
				rstLog(3) = FileName
				
			rstLog.Update 
				
			
			if lngNumberUploaded = 0 Then
				Response.Write "<STRONG>Saving Files...</STRONG><BR><BR>"
				
			End if
				
		Response.Write SavePath & "\" & FileName & "<BR>"
		
		
		lngNumberUploaded = lngNumberUploaded + 1
	
	End if
		
'Get then next boundry postitions if 
'any.
	lngCurrentBegin = lngCurrentEnd
	lngCurrentEnd = instr(lngCurrentBegin + 9 ,strDataWhole,strBoundry) - 1
	
	'Prevents infinate loop.
		countloop = countloop + 1
		if countloop = 100 Then
			Response.Write "looped 100 times terminating script!"
			'Close the Log
			if rstLog.State then rstLog.close
			if conn.State then conn.Close
			
			Response.End 
		End if
loop
	'Close the Log
		if rstLog.State then rstLog.close
		if conn.State then conn.Close
			
		Response.Write "<STRONG>" & lngNumberUploaded & " File(s) Uploaded</STRONG>"
		Response.Write "<BR><BR><INPUT type='button' onclick='document.location=" & chr(34) & "saveany.asp" & chr(34) & "' value='<< Back to Upload' id='button'1 name='button'1>"	 						
	Case 3
	
		'get prev path if any
		path = Request.QueryString("Path")
		'if Not assign one
		if path = "" or isempty(path) Then
			path = server.MapPath(".")'"c:\inetpub"
		End if
		'create filesystemobject
		Set fso = CreateObject("Scripting.FileSystemObject")
		'get a folder object
		Set f = fso.GetFolder(path)
		path = f.path
		
		'limit access To hard drive
		'if lcase(left(path,10)) <> "c:\inetpub" Then
		'	path = "C:\Inetpub"
		'	Set f = fso.GetFolder(path)
		'	path = f.path
		'End if
		
		Response.Write "<H2>Server Browse Form.</H2>"	
		Response.Write "<FORM ACTION='saveany.asp?func=1' METHOD=POST>"
		Response.Write "<TABLE width=400 border=1 cellpadding=0 cellspacing=1>" & vbcrlf
		Response.Write "<TR><TH colspan=2>" & path & "</TH></TR>"
		Response.Write "<TR><TD colspan=2 align=left><A href='saveany.asp?func=3&path=" & path & "\..'><STRONG>Parent ..</STRONG></A></TD></TR>" & vbcrlf
		
		'get subfolders collection
		Set fc = f.subfolders
		
		'enum subfolders 
		For Each folder In fc
			Response.Write "<TR><TD align=left><INPUT NAME=BrowseServer TYPE=CheckBox Value='" & folder.path & "'></TD><TD style='padding-left: 20px;' align=left><A href='saveany.asp?func=3&path=" & folder.path & "'>" & folder.name & "</A></TD></TR>" & vbcrlf
		Next
		
		'if there is a folder display the Select folder button
			if fc.count > 0 Then
				Response.Write "<TR><TD align=left colspan=2><BR><INPUT name=submit type='submit' value='Select Folder'></TD></TR>"
			End if
		
			Response.Write"<TR><TD colspan=2><INPUT name=cancel type='Button' value='Cancel' onclick=document.location='saveany.asp?func=1'></TD></TR>"
		
		Response.Write "</TABLE>" & vbcrlf
		Response.Write "</FORM>"
End Select
	
%>
</BODY>
</HTML>
<SCRIPT LANGUAGE=vbscript RUNAT=Server>
	function ParseForm(strFieldName)
	
		Set strFormData = CreateObject("Scripting.Dictionary")
		lngCount = -1
		'Try To find the Field
		lngNamePos = instr(1,strDataWhole,"name=" & chr(34) & strFieldName & chr(34))
		
		'Parse through data In search of fields
			Do While lngNamePos <> 0
				lngCount = lngCount + 1
				lngBeginFieldData = instr(lngNamePos,strDataWhole,vbcrlf & vbcrlf)+4
				lngEndFieldData = instr(lngBeginFieldData,strDataWhole,strBoundry)-2
				strFormData.Add lngCount, mid(strDataWhole,lngBeginFieldData,lngEndFieldData-lngBeginFieldData)
				lngNamePos = instr(lngEndFieldData,strDataWhole,"name=" & chr(34) & strFieldName & chr(34))
				
			Loop
			Set ParseForm = strFormData
	End function
	
	function CreateDatabase
			'on error goto 0
	'create an instance of a catalog(Database)
		set cat = server.createobject("ADOX.Catalog")
	'create the catalog	 
			cat.Create ("Provider='Microsoft.Jet.OLEDB.4.0';Data Source='c:\inetpub\UploadLog.mdb'")	
			set connNew = cat.ActiveConnection 
			connNew.CursorLocation = 3
		'get the Connection and add a Table and the following fields	
			connNew.execute "Create Table [Logs]"
			connNew.execute "Alter Table [Logs] Add Column [DateTimeStamp] DATETIME"
			connNew.execute "Alter Table [Logs] Add Column [IP Address] TEXT(15)"
			connNew.execute "Alter Table [Logs] Add Column [Path] TEXT(100)"
			connNew.execute "Alter Table [Logs] Add Column [File] TEXT(100)"
			connNew.execute "Alter Table [Logs] Add Column [Notes] MEMO"
		'clean up	
			connNew.close
			set connNew = nothing
			set cat = nothing
	end function
	
</SCRIPT>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/4/2001 5:24:30 PMRObot X5

This Rocks .....
Keep up the good work....
I am kinda pissed I needed this about a year a go ....
I had to make my own dll and that sucked.....
once again You Rock!
(If this comment was disrespectful, please report it.)

 
4/10/2001 3:13:33 AMSam Moses

Wait a minute... a free asp uploader that actually works??? Man, I wish I would have had this three months ago. Great scripting dude.
(If this comment was disrespectful, please report it.)

 
4/19/2001 8:56:43 AMKaustav Acharya

Awesome Job!
(If this comment was disrespectful, please report it.)

 
5/15/2001 5:04:12 PMRadames

Gracias, muchas gracias!!!
(If this comment was disrespectful, please report it.)

 
6/13/2001 1:23:52 AMSam Moses

As it turns out, I actually have a use for this wonderful script again. Is there a way to restrict access to gif or jpg on the server side rather than the client side. I wrote a javascript to do that on the client side, but it can be worked around. Any ideas?
(If this comment was disrespectful, please report it.)

 
6/14/2001 2:33:03 PMRodrigo Fiche

Very good!!!
Thanks, Karl P. Grear...

(If this comment was disrespectful, please report it.)

 
6/15/2001 10:58:23 PMKarl

Gary
I have had no trouble, althoght I admit I use IE 5.5 and IIS 5.0.

You may try updating your browser and see if that helps :)

Karl
(If this comment was disrespectful, please report it.)

 
6/15/2001 11:02:59 PMKarl P. Grear

David,

Yes you must. Once you get your first form or querystring value you can no longer request.binaryread and visa versa.
(If this comment was disrespectful, please report it.)

 
6/15/2001 11:08:38 PMKarl P. Grear

Sam and Richard,

Yes you can filter by file type.
One easy way is to check the file extension before you save the file.

Karl
(If this comment was disrespectful, please report it.)

 
6/15/2001 11:11:08 PMKarl P. Grear

I just want to thank everyone for the great response and all the votes.
I am glad that so many people are finding this code usefull.

Karl
(If this comment was disrespectful, please report it.)

 
6/19/2001 12:38:26 PMJuls

Hi, Thanks for posting the code.
(If this comment was disrespectful, please report it.)

 
6/20/2001 6:00:38 AMJason L

This code is useful but i need more functions that just uploading. Could you add some coding that will add the file name into database and another page to display the graphics uploaded ? Thank you.
(If this comment was disrespectful, please report it.)

 
6/20/2001 11:45:55 PMKarl P. Grear

Andy

Hmmm.... What browser are you using?
(If this comment was disrespectful, please report it.)

 
6/22/2001 2:43:59 PMAndy

I'm using IE 5.5, but it also has to work in Netscape 4.? and above.
(If this comment was disrespectful, please report it.)

 
6/27/2001 1:24:41 PMEric

Andy...

I was having the same problem. Somehow, my submit button was given name and id attributes by my editor without my knowing. This was causing the filename
(If this comment was disrespectful, please report it.)

 
6/29/2001 3:16:02 PMKarl P. Grear

Ok,
I added support to get form data, which eliminates the submit button name issue.

Thanks for your votes, support, and input. :)

Karl
(If this comment was disrespectful, please report it.)

 
6/30/2001 10:00:27 AMfadhil

i want to ask about the password...there is error massage appear. (the password u enterd is invalid)
(If this comment was disrespectful, please report it.)

 
7/6/2001 3:45:28 AMgopal

hi, thanks for nice script.
when i upload the form with a selectbox of multiple selection i cannot get more than one value in the Parseform().
advance thanks for any help
(If this comment was disrespectful, please report it.)

 
7/9/2001 6:11:31 AMClifford

Fantastic man, keep on going. I hope you win this month.
(If this comment was disrespectful, please report it.)

 
7/9/2001 11:51:21 AMKarl P. Grear

Another update,

you can now get all the values of form items with the same name. The new code returns a dictionary object with the value(s) populated for the form item.

Hope this helps :)
Karl
(If this comment was disrespectful, please report it.)

 
7/9/2001 12:15:21 PMKarl P. Grear

Note from Author:

I wrote this script because I spent hour after hour searching the web for it when I needed it, and all I found was sites that wanted me to pay for it. Frustrated and more then a little disgusted I decided that I would figure out how to do it my self. The script above is the results of my effort and the ideas and input of those who have used and voted for it. I would like to again thank everyone for his and her votes and input.

(If this comment was disrespectful, please report it.)

 
7/13/2001 1:42:01 PMdan

Wondering is there a way to direct where the files will be upload as well as have it viewable on a webpage? I will be uploading
(If this comment was disrespectful, please report it.)

 
7/25/2001 11:36:27 AMRally

I having problem on password. Could you help me resolve this issue.
(If this comment was disrespectful, please report it.)

 
7/30/2001 7:12:35 AMKodeKrash

I was just reading over some of the posts here and wanted to point out that different Scripting Engine versions will cause some of these errors. I assume that Karl wrote this running at least VBScript 5.0 on his server. If you are not sure what Scripting Engine you are running, just grab the ScriptEngineVersion checker from www.intelidev.com. Other than that Karl, great job. :o)
(If this comment was disrespectful, please report it.)

 
7/30/2001 9:15:44 AMPeter

Great job ... and it works! I found only a small mistake ...
Enter security password.
7/30/2001 9:58:53 AMKarl P. Grear

Thanks to Perer for pointing out the HTML error. Thanks to KodeKrash for the heads up on scripting engine :)

Karl


(If this comment was disrespectful, please report it.)

 
8/3/2001 1:29:29 PMKas

I am receiving an error about password and I have entered every password that exists and it still give me the error. Could you please help I really need this.
Thanx
(If this comment was disrespectful, please report it.)

 
8/7/2001 10:05:42 AMSean Street

Excellent. Worked like a gem. Now to take it apart and figure out how it works. Thanks for sharing.
(If this comment was disrespectful, please report it.)

 
8/11/2001 9:17:51 AMDeryck

I need the password and to know how to add other info(title, desc., etc) into an MS Access2000 DB and make a web page post that info, along with a link to the file so a user can download it at the same time. And if it is and image how do I have it posted to the page one after another automaticly? thanx
(If this comment was disrespectful, please report it.)

 
8/11/2001 9:20:32 AMDeryck

The password is::

OkToSend
(If this comment was disrespectful, please report it.)

 
8/11/2001 10:45:29 PMDeryck

That was a clearer version of what I already posted.
(If this comment was disrespectful, please report it.)

 
8/14/2001 12:48:30 PMJoel

Thanks man, great code... very good work...
(If this comment was disrespectful, please report it.)

 
8/20/2001 12:14:59 PMcody

Nice work!
But how to upload files to a "user/password" protected directory using ASP?
(If this comment was disrespectful, please report it.)

 
9/4/2001 7:56:42 AMSnakefighter

May be it works :)
But as it is said previously how can we upload file if's password protected.

snakefighter99@hotmail.com
(If this comment was disrespectful, please report it.)

 
9/4/2001 10:34:12 AMKarl

By password-protected directory, I assume you mean a directory that the default anonymous account does not have access to. Here are a few solutions and a few suggestions.

1. Change the default anonymous account for saveany.asp to one that does have access to the directory in question. Store a password in a text or database file saved outside the web root, preventing it from being downloaded.


(If this comment was disrespectful, please report it.)

 
9/4/2001 10:35:38 AMKarl P. Grear

2. Give the default anonymous account for saveany.asp, rights to the directory in question. Store a password in a text or database file saved outside the web root, preventing it from being downloaded


(If this comment was disrespectful, please report it.)

 
9/4/2001 10:36:42 AMKarl P. Grear

3. Disable anonymous access to the saveany.asp file in IIS. This will prompt the user to log on to the server with a valid NT Username and Password. In order to authenticate the user must log on to an account, which has access to the saveany.asp file and/or directory. In order to upload the account must have ‘change’ rights to the upload directory in question.

4. Force the user to log on with a valid NT Username and Account, using the following script. In order to authenticate the user must log on to an account, which has access to the saveany.asp file and/or directory. In order to upload the account must have ‘change’ rights to the upload directory in question.

<%
if Request.ServerVariables("LOGON_USER") = "" then
Response.Status="401 Access Denied"
end if
%>


NOTE: Method 2 is the preferred method .

Good Luck. And thanks for voting :)

Karl

(If this comment was disrespectful, please report it.)

 
9/10/2001 11:49:12 AMChris

I'm using Win2K and IE 6.0. Every time I try to upload any file, it says Permission denied
/saveany.asp, line 275. I've tried giving every permission i know of and I still can't get it to work. Any ideas would be appriciated. Thank you


(If this comment was disrespectful, please report it.)

 
9/12/2001 10:11:10 AMMAKO

How can I Upload a file when i know only the Url of the server, and I can't navigate it's folders? I try to put the URL in the server Path But It doesn't work. (sorry for the bad english), thanks
(If this comment was disrespectful, please report it.)

 
9/12/2001 10:15:16 AMMAKO

I can't upload any file if i try to put the URL of the server. I can't know the path of the machine and i can't navigate it's folders. What can i do?
(sorry for the bad english), Thanks MAKO
(If this comment was disrespectful, please report it.)

 
9/30/2001 9:02:18 PMSam Moses

I love the new server browser feature. Is there a way to get it to upload more than three files at once?
(If this comment was disrespectful, please report it.)

 
10/2/2001 2:23:01 AMrobinash

Is there any way to upload multiple
files without having to have x amount
of INPUT NAME=File1 SIZE=30 TYPE=file>
??????? I can't find the solution...

(If this comment was disrespectful, please report it.)

 
10/4/2001 5:36:06 AMnoel rodrigues

Hello Karl, wonderful job by you.

I need a help, i have the following code

<%
formsize = request.totalbytes
formdata = request.binaryread (formsize)
response.binarywrite formdata
%>

now how do i write the contents of
(If this comment was disrespectful, please report it.)

 
10/4/2001 5:54:51 AMnoel

Karl please help,
my code to receive file is :
formsize = request.totalbytes
formdata = request.binaryread(formsize)
response.binarywrite formdata
now i want to write it to a text file & later read it like binary read. How can I do?

Urgent Please help. Thanks.

(If this comment was disrespectful, please report it.)

 
10/9/2001 7:39:21 AMAlbertos

here u have a very good code... but there is a small prob...if u have a field in your form and the text there is not in english (eg. greek characters) then the parseform(
(If this comment was disrespectful, please report it.)

 
10/9/2001 8:01:22 AMsfong15@yahoo.com

Very good work. Some minor comments. (1)change Type=
(If this comment was disrespectful, please report it.)

 
10/10/2001 7:08:30 PMDoug

Thanks a lot for the posting! I'm having a small problem, though, and was hoping for some help...

After choosing a directory on the server, and a file to upload, as well as entering the password I submit and get the following error:

Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'ForWriting'
/samples/test/saveany.asp, line 81

Thanks a lot in advance!
Doug
(If this comment was disrespectful, please report it.)

 
10/10/2001 7:24:07 PMDoug

duh. Please excuse the last post...

WORKS GREAT!
THANKS FOR POSTING!!

(If this comment was disrespectful, please report it.)

 
10/11/2001 4:12:35 PMalan

the upload file size is not same as the origin, plz help
(If this comment was disrespectful, please report it.)

 
10/11/2001 4:14:22 PMALAN

Hi,
the script is so good. However, after i upload the files to the folder, the files size is not same as the original once plz help
(If this comment was disrespectful, please report it.)

 
10/23/2001 1:58:56 AMWaqas

Hi Guys,
I am facing this problem,
it is working fine on my local server, but when I host it at my virtual webserver, it gives the following error: Can anyone advise me, what's the problem is. Is it a matter of rights or ...???
an immediate reply shall be very highly appreciated. kind regards,

- waqas
urf3@yahoo.com

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Request.TotalBytes'

/verizon/outputFile.asp, line 16

(If this comment was disrespectful, please report it.)

 
10/23/2001 1:04:29 PMKenneth

Will this code be able to allow my users to upload MP3 file's also? If not then do you know where I can find one?
(If this comment was disrespectful, please report it.)

 
10/23/2001 1:07:01 PMKenneth

Will this code allow my users to upload mp3, jpg, and gif files to my server? If not all, then do you know where I can find one?
Thanks
(If this comment was disrespectful, please report it.)

 
11/1/2001 4:05:29 PMKenneth

Hello I tried to upload a file using the password "OkToSend" but I kept getting the following response: Invalid Password
Is there another password I could use?
Also, Is there a way I can make the "Browse Server" section automatically default to a specific folder so that my users will not have to input anything in that section?

Thanks for your help.
(If this comment was disrespectful, please report it.)

 
11/9/2001 11:17:43 AMBrandon

Hi, Thanks for taking the time to come up with this code. But I seem to have a slight problem, I've copied and pasted the code, but for some reason I keep getting the following error when I click the upload file:

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Append'

/ccsys/uploader.asp, line 101

Any idea what causes this?

Thanks,
Brandon.
(If this comment was disrespectful, please report it.)

 
11/17/2001 1:46:23 AMChris

This was a great help in my coding endeavors. I've been able to take the code you supplied here and do some pretty amazing stuff with it. I've incorporated it into creating completely dynamic file listings for application uploads and downloads and I never have to leave the original web page.

This was just what the doctor ordered.

Great job...!!!
(If this comment was disrespectful, please report it.)

 
11/27/2001 7:09:19 PMstanley

the code is fantactic, but i am running into problems when i submit , even with the proper password 'oktosend' . This is the error message:

Microsoft VBScript runtime error '800a0034'

Bad file name or number

/saveany.asp, line 403. Does anyone have any ideas. It seems that there has been similar problems discussed in the Feedback log.

please help me use your great code

stanley
(If this comment was disrespectful, please report it.)

 
11/28/2001 10:44:21 PMhendra

the code is fantactic, but i am running
into problems when i submit , even with
the proper password 'oktosend' . This
is the error message:

Microsoft
VBScript runtime error '800a0034'


Bad file name or number


/saveany.asp, line 403. Does anyone
have any ideas. It seems that there has
been similar problems discussed in the
Feedback log.

please help me use
your great code

hendra
(If this comment was disrespectful, please report it.)

 
11/28/2001 10:49:04 PMhens

my problem same with above reason
whwn i filled my paasword t.s response is :

Microsoft
VBScript runtime error
'800a0034'
Bad file name or number
/saveany.asp, line 403
please help me....
(If this comment was disrespectful, please report it.)

 
11/30/2001 5:02:48 PMjay

this code is spectacular. thank you so much for sharing. you have no idea what a headache it has been trying to figure the code for uploading without using a COM object... sooooo, this code is most appreciated! Great JOB A+++++

Jay
(If this comment was disrespectful, please report it.)

 
12/12/2001 11:40:03 AMBrent

Thanks for some excellent code. I've been trying to modify it to have some type of an alert message if a file with the same name exists.

Has anyone been able to do this?

(If this comment was disrespectful, please report it.)

 
1/15/2002 4:50:46 PMMirjana Jovanovic

Wonderful code. Thanks for posting it.
It would be good if the file renaming was provided as well.

Thanks again
(If this comment was disrespectful, please report it.)

 
1/18/2002 4:58:23 PMTanya

Thank you, thank you, thank you! I've been looking for a file upload script for a long time. Thank you for sharing your work with us!
(If this comment was disrespectful, please report it.)

 
1/22/2002 2:42:41 PMRobert

Thanks a ga-billion for this code!
Can anyone help me with examples of how to get form data into the database as well with out using request.form. You have to convert form data to ASCII?
Any help would be appreciated..
(If this comment was disrespectful, please report it.)

 
1/30/2002 1:20:45 PMKathy

good code thanks
(If this comment was disrespectful, please report it.)

 
2/22/2002 10:11:19 AMPaul Mather

Nice job. Works great!
(If this comment was disrespectful, please report it.)

 
2/28/2002 11:32:44 AMFrank

WOW!!!
(If this comment was disrespectful, please report it.)

 
3/6/2002 12:56:16 PMChris

This code is excellent. With some tweaking and some Javascript I have created a look alike of Microsoft's Sharepoint Upload.htm. This doesn't require the WebBot and works just as well. Additionally mine now has a Comment field that takes the information and adds it to a SQL DB.

Thanks again...
(If this comment was disrespectful, please report it.)

 
3/6/2002 4:35:24 PMDan W

Nice work, thanks.
(If this comment was disrespectful, please report it.)

 
3/7/2002 5:17:17 AMdeejay

Just great code!!
(If this comment was disrespectful, please report it.)

 
3/11/2002 4:41:44 PMTony

this is great! can you limit the file extension upload? ex: .jpg .gif only? don't let them upload .exe or .dll files to the website ... waiting for your code!
(If this comment was disrespectful, please report it.)

 
3/11/2002 9:08:25 PMTomGlen

1st Karl this is great work. Thank you for your willingness to share this with everyone.

Regarding file extension blocking, I got something to work by parsing the extension from the filename variable and then putting a if statement that controls whether the block of code that writes the file gets executed.

Does anyone know how to file the file size?
(If this comment was disrespectful, please report it.)

 
3/15/2002 8:15:17 PMTony

can you send the " a if
statement that controls " for me at sharky626@yahoo.com? I not know much about asp and my english real suk :( thanks alot! about filter the file side, look in the saveany.asp for this Server.ScriptTimeout=300.
(If this comment was disrespectful, please report it.)

 
3/17/2002 9:07:05 PMTony

any know how to limit the file extension? help me with the code please!
(If this comment was disrespectful, please report it.)

 
3/18/2002 5:30:25 AMKrishna

Ur asp upload is fabulous but i just want to ask u something more out of ur code like when u upload the file if there is a file with the same name , is it possible to give an alert message and asking them to give a new name for the file which they r uploading.

cheers
Krishna
(If this comment was disrespectful, please report it.)

 
3/19/2002 4:57:08 PMDon

When I change the directory from the default -- c:\inetpub to my directory--d:\web it's showing the new directory but I can't browse through it. I added IUSER to this folder for access but nothing. Any thoughts?
(If this comment was disrespectful, please report it.)

 
3/19/2002 5:06:05 PMdon

nevermind I got it.
(If this comment was disrespectful, please report it.)

 
3/26/2002 5:20:59 PMTyson

Thanks for the great code. I had this working in 60 seconds. I appreciate your efforts to share code with other users free of charge. This really helps us learn and accomplish our daily challenges. THANKS AGAIN!!!
(If this comment was disrespectful, please report it.)

 
4/2/2002 9:07:45 AMMike

After reading the comments I am certain that this code works. I have an absolute need for this code, but am quite new to ASP. I use the free services of Brinkster.com to host my ASP site, after pasting this code in I got nothing, are there places in the code I need to change?
Thankyou for your anticipated help.
(If this comment was disrespectful, please report it.)

 
4/2/2002 9:38:12 AMmike

I would like to append to my last post. I still need assistance, but I at least have the form up now. I had to set the server timeout to 60 as this is the max brinkster will allow. The problem now is that when I hit the server browse button I get the "page cant be viewed" Message. Also when I enter my password, I get an invalid password message, although I know I am entering the correct password for my account.
I am very excited to put this code to use, with a little guidance I'm hoping i'll be able to.
Thanks!
-Mike
(If this comment was disrespectful, please report it.)

 
4/3/2002 1:24:28 PMTony

any one can write for me a blocking file extension to put in this script? thanks a lot man!
(If this comment was disrespectful, please report it.)

 
4/4/2002 10:37:33 PMBruce

To browse the directory of a remote server where you don't know the path...change the code in function 3 to path = server.mapPath("."). Now it will work :)
(If this comment was disrespectful, please report it.)

 
4/11/2002 5:58:33 AMJohn

I am beginner of ASP and I would like to know how to get the name of the file(s) that we had been uploaded. Any ideas for me.
(If this comment was disrespectful, please report it.)

 
4/12/2002 9:31:44 AMEd

Really like the code, feel like I am missing something simple but I keep getting a Type Mismatch :'ParseForm'. Please help when possible
(If this comment was disrespectful, please report it.)

 
4/12/2002 9:35:22 AMEd

Nevermind, I was incorrect on my end, you code works great!
(If this comment was disrespectful, please report it.)

 
5/16/2002 8:34:41 PMYuval

I get an error
(If this comment was disrespectful, please report it.)

 
5/16/2002 8:37:04 PMYuval

I get an error "the page cannot be Found" (...asp?func=2). Help.
(If this comment was disrespectful, please report it.)

 
6/1/2002 1:16:18 PMArun Kumar

Hi karl
you have written a fantastic code
and you have become my inspiration figure
i tried to reframe you code into two asp pages one.asp and two.asp
but got this error
Error Type:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'mid'
/asp/testqp/two.asp, line 36
i can't paste code here due to area constrin and unfortunately i was not able to sign in, to email you also,
can any body tell whats karl's mail id
karl....karl i need you help very much
please mail me at arunkw@yahoo.com
(If this comment was disrespectful, please report it.)

 
6/7/2002 12:22:17 AMPearl

This is a great code truely beyond my capabilities...... maybe that's why I can't upload anything other than text files... hmm...
Can anyone help me with that? The file goes to the server but the contents don't show up.
Any help would be greatly appreciated. Thank you.
pearl@grandtech.com.tw
(If this comment was disrespectful, please report it.)

 
6/7/2002 12:23:05 AMPearl

This is a great code truely beyond my capabilities...... maybe that's why I can't upload anything other than text files... hmm...
Can anyone help me with that? The file goes to the server but the contents don't show up.
Any help would be greatly appreciated. Thank you.

(If this comment was disrespectful, please report it.)

 
6/13/2002 9:12:46 AMAarti

Hi Karl,
Great job. I got exactly what i was looking for.
Thank you
(If this comment was disrespectful, please report it.)

 
6/17/2002 12:27:05 PMTony

Very nice.
I had to mess around a bit with permissions (and my drive was D: not C:), but now I can build my site without having to remote into the server every time I change a file.
(If this comment was disrespectful, please report it.)

 
6/18/2002 1:54:19 PMAlex

Karl, great work! I've been using this uploader for many projects now...I have a quick question: I'm uploading two files to the server and I wanted to know how to grab the two separate file names so I can write them to a database. Thanks for your help and keep up the good work!
(If this comment was disrespectful, please report it.)

 
6/18/2002 11:26:14 PMKarl P. Grear

Ok everyone here is an update.
1. I fixed the textarea issue
2. by popular demand I added the ability to save a log into an access database

Karl

p.s. I have been bouncing around the PSC All Time Hall of Fame top 10 for over a year now thanks to you. Thanks for all the votes and support :)
(If this comment was disrespectful, please report it.)

 
7/17/2002 2:33:02 PMmark tin

It doesn't work on windows 2000 server (chinese version), any idea?
(If this comment was disrespectful, please report it.)

 
7/17/2002 2:34:24 PMmark tin

exmple:
the file has been updated to the target folder, however, the file cannot be opened, it seems corrupt.

(If this comment was disrespectful, please report it.)

 
7/23/2002 10:18:39 PMChad Gutowsky

I can only get small file to upload, otherwise I time out. Can you help?
(If this comment was disrespectful, please report it.)

 
7/24/2002 12:45:40 PMLuke

Site is on my D drive, not C. Works perfectly on C, but moving script to D does not work. What am I missing?

Thanks ahead of time!
(If this comment was disrespectful, please report it.)

 
7/24/2002 4:31:44 PMChad Gutowsky

Thanks for standing buy your code and answering questions. I gave you 5, but would give you 6 if I could.
(If this comment was disrespectful, please report it.)

 
7/29/2002 11:02:09 PMMatt Franz

Although this code has already recieved an award, and it is the Number 1 on PSC (as of 7/29/02) I would like to say this is the best PSC code I have ever seen.

Although I don't post many of my own scripts, however I have to say that I have used this code weekly. I have morphed this example to about 100 different possibilities and still coming up with more.

If you are using another upload script, get rid of it and use this one. 5 of 5 from me!
(If this comment was disrespectful, please report it.)

 
8/9/2002 7:11:11 AMkiran

Excellent and very useful code. Thanx.. a lot . I had been searching for file upload program from a long time.This is simply wonderful!
But can you tell how to restrict the users from uploading the .exe or .dll files, on the server?
(If this comment was disrespectful, please report it.)

 
8/12/2002 2:12:54 PMASPMan

This is great code, I also like the code that creates an access db, tables, etc. on the fly. Great work. Ill give ya a vote :)

(If this comment was disrespectful, please report it.)

 
8/13/2002 12:45:53 PMAndy Landers

Brilliant-disecting it has taught me loads ..One problem though everything works fine but, the logs created etc but the file doesn't appear in the destination folder. I'm running IIS 5 on my home PC to test it..Can you help e-mail: andy_landers@hotmail.com

(If this comment was disrespectful, please report it.)

 
8/18/2002 5:05:16 PMNathan Huebner

This code is the most absolute perfect code.. I rate it 1000000 out of 10 for the most complete coding I have ever seen on planetsourcecode.com!!!!
(If this comment was disrespectful, please report it.)

 
9/3/2002 2:37:05 PM

Karl,
Great job! I thank you for all the hard work, so that I could focus on other
(If this comment was disrespectful, please report it.)

 
9/3/2002 2:38:36 PM

I am getting the error "Object doesn't support this property or method: 'adLongVarChar'". Any ideas?
(If this comment was disrespectful, please report it.)

 
9/3/2002 3:51:03 PM

The textarea field isn't logging to the database. Any ideas.
(If this comment was disrespectful, please report it.)

 
9/19/2002 7:46:40 AMmfalme

Nice coding
(If this comment was disrespectful, please report it.)

 
10/5/2002 12:58:22 AM

Amazing coding, I only had one problem which was a buffer issue for somereason, don't know why, but it works.
(If this comment was disrespectful, please report it.)

 
10/14/2002 12:39:08 PMek-freelancer

This is absolutely brilliant. I wonder if I will ever get up to your level of expertise. Again, its an absolute beauty. Now I'll try and strip it to understand what happened.Thanks.
(If this comment was disrespectful, please report it.)

 
10/17/2002 8:55:11 AM

I can upload files to my web site with this code but I can't upload any file to another web site at the same web server which can be browsed... Why? It says Uploaded but it doesn't !
(If this comment was disrespectful, please report it.)

 
10/24/2002 3:09:45 PM

Is there a size limitation to file uploads with this script? small files seem to transfer without error, larger files write the header but no data (0 bytes) anyone with the same problem already have it resolved?
(If this comment was disrespectful, please report it.)

 
11/28/2002 5:38:00 AM

This code was amazing.
Helped me like an angel...
Thanx Carl.


(If this comment was disrespectful, please report it.)

 
12/2/2002 9:52:00 PM

IIS 5.1 error
Response object error 'ASP 0157 : 80004005'

Buffering On

/upload2/saveany.asp, line 40

Buffering cannot be turned off once it is already turned on.
Please Help!!!!!!!!!!!
(If this comment was disrespectful, please report it.)

 
12/3/2002 10:45:54 AM

Great Code!
How can I pass the form value "TArea"
which is the notes field to the note
field in the database?
'Log the date and time, the IP, the Path, and the Filename
rstLog(0) = Now()
rstLog(1) = request.ServerVariables("REMOTE_ADDR")
rstLog(2) = SavePath
rstLog(3) = FileName
rstLog(4) = ParseForm("TArea")?????
(If this comment was disrespectful, please report it.)

 
12/4/2002 2:12:48 PM

i am having a similar problem as discussed in one of the other notes (but not answered). i got it to work, or so it seemed, but the files never got copied. i get the
(If this comment was disrespectful, please report it.)

 
12/4/2002 2:13:55 PM

i am having a similar problem as discussed in one of the other notes (but not answered). i got it to work, or so it seemed, but the files never got copied. i get the "files sucessfully copied" message and it shows the path that they were supposedly copied to, but the files aren't there. any thoughts?
(If this comment was disrespectful, please report it.)

 
12/24/2002 4:51:51 AM

I can´t find the file i uploaded in the specified directory. What´s wrong?
(If this comment was disrespectful, please report it.)

 
1/16/2003 2:48:37 PM

I copied all of the text then saved it as an asp.

Then when I run it on either my web server or local host it get:

Error Type:
Response object, ASP 0157 (0x80004005)
Buffering cannot be turned off once it is already turned on.
/firstchoice/index.asp, line 40

What am I doing wrong?
(If this comment was disrespectful, please report it.)

 
2/5/2003 3:19:25 AM

Like others have said, this code appears to work, but the file never gets uploaded.

What could be wrong? The only thing I've modified is the Connection string to point to my SQL Server.
(If this comment was disrespectful, please report it.)

 
2/6/2003 9:43:05 PM

I want to determine the file size of the uploaded one becuase it gives error some times when file more than 3 mb is uploaded if there is some way to find it then mail me
(If this comment was disrespectful, please report it.)

 
2/12/2003 10:20:14 PM

Very fancy!
(If this comment was disrespectful, please report it.)

 
2/13/2003 9:44:37 PM

First thanks for a exelent script. But I have at problem with creating a database.

As I am a newbee in database, is there anyone who can tell me which fields I shall have in the database?

(If this comment was disrespectful, please report it.)

 
2/18/2003 8:06:35 PMKarl P. Grear

>If the script finishes and the file is not present on the web server where you selected to save it. I would check the folder permissions for the directory in question. The anonymous account or authenticated account must have full read/write or ‘Modify’ permissions to the directory in question.

Karl
(If this comment was disrespectful, please report it.)

 
2/19/2003 9:47:51 PM

Help,
I am new at this. Why am I getting the following?
Response object error 'ASP 0157 : 80004005'

Buffering On

/saveany.asp, line 31

Buffering cannot be turned off once it is already turned on.

I see lots of people have this same problem. I changed the connection strings to the full path on the hosting server. Is there something else in the code that I have to change to get it to work?

Thanks in advance - JB
(If this comment was disrespectful, please report it.)

 
2/20/2003 5:38:23 PMstrick

To fix the buffering problem in IIS.
- Open IIS console
- Go into properties for the folder that you have setup as your application starting point.
- click the Configuration button at bottom in Application Settings section
- go to Options tab
- uncheck Enable Buffering
(If this comment was disrespectful, please report it.)

 
2/24/2003 7:26:02 PMnfs

Nice tie and good code.Thanks.

Hi, Do you want to make money with your programming skills ? Software Objects provide following services : 1)Sell your software. 2)Post a software to be done. 3)Bid on the software projects. 4)Buy software Thanks and have a nice day. Software Objects http://www.thesoftwareobjects.com

(If this comment was disrespectful, please report it.)

 
2/26/2003 5:53:01 PM

I managed to get it up and running with a few modifications. I think I got around the buffering problem by setting it to true instead of false. I also managed to get the database working as well. All in all, the script works beautifully. Thank you much for sharing. I just wish I understood it a little better. Is there some way I can just have the user access only one folder for the uploads and not even give them the option of being able to navigate around on the web server? Any direction would be most appreciated.

Thanks again Karl, good Job!

- JB
(If this comment was disrespectful, please report it.)

 
3/4/2003 12:50:38 PM

Great Code!! Thank you for sharing...
(If this comment was disrespectful, please report it.)

 
3/4/2003 10:16:48 PM

I copy all the coding and save in .asp file. But why i stii ccn't to run it.I run it via IE.
(If this comment was disrespectful, please report it.)

 
3/4/2003 10:19:45 PM

I copy all this code and save in .asp file, but i can't to run it via IE, why?
(If this comment was disrespectful, please report it.)

 
3/28/2003 3:51:42 PM

Excellent work. Good job!
(If this comment was disrespectful, please report it.)

 
3/28/2003 9:05:00 PM

Great stuff, Karl! Thanks for sharing this code.

I was referenced to this code from a programming forum where folks were beating their collective heads against the wall trying to build a DLL to do the same thing.

Your hall of fame status is well deserved.
(If this comment was disrespectful, please report it.)

 
4/4/2003 12:28:48 PM

You rule - this is incredibly helpful and has just made my week a lot more productive. Thank you!
(If this comment was disrespectful, please report it.)

 
4/7/2003 9:54:10 PM

As everyone else says - This rox!

thanks much
(If this comment was disrespectful, please report it.)

 
4/14/2003 1:24:23 AM

Karl, your work is great!

But I have some issue on file uploading.
The size of file is smaller than the original after the upload. And thus failed to open the file.

But it DOES work fine on .csv file, but the error occur on .jpg , .gif, etc file.

Can you help me to solve it?
(If this comment was disrespectful, please report it.)

 
4/14/2003 11:05:43 AM

Anyone can help me to solve the above issue? thx a lot!
(If this comment was disrespectful, please report it.)

 
4/18/2003 12:05:56 AM

Nice code i made i codet exactly same one 1999:) but nice anywayz
(If this comment was disrespectful, please report it.)

 
4/21/2003 12:40:09 AM

Great Upload code! Do you have any suggestions on how I can limit file sizes?

Thanks in advance.

m-
(If this comment was disrespectful, please report it.)

 
5/6/2003 3:05:10 PM

I have copied and saved and ran this code and it appears to be run but when I looked in the folder where the file should have been saved it was empty. Is there something else I need to do. Can anyone help?
(If this comment was disrespectful, please report it.)

 
6/11/2003 5:43:20 AM

This is great code, I also like the
code that creates an access db. Thanks for this code.
(If this comment was disrespectful, please report it.)

 
6/27/2003 10:17:34 AM

Great work Karl. You certainly get an "excellent" vote from me.

I found your code very useful and have been able to use it on a couple different projects, with the anticipation of using it on several more.

Thanks for the effort you put into this. It's greatly appreciated.
(If this comment was disrespectful, please report it.)

 
7/4/2003 10:56:55 AM

Carl,
Great code Carl!! Really Excellent!!

But how can i save the uploaded filenames into my database as a reference to the files? I already tried with the request.form command but that doesn't work. Can you help me please??

Tanx in advance


Dimi
(If this comment was disrespectful, please report it.)

 
7/6/2003 9:57:12 PM

Hi i dun know what is the password?
Can someone help me with it? thanks.z

The following Error occured.
The Password you entered is invalid.

Hit the back button, make the needed corrections and resubmit your information
(If this comment was disrespectful, please report it.)

 
7/7/2003 4:04:40 AM

Similar to comments above it appears to be working but no file is being saved. Can you help please?
(If this comment was disrespectful, please report it.)

 
8/22/2003 3:28:09 PM

Karl - Wonderful script - easy to implement (only a few bugs on my end). Any way to limit upload to a specific directory? Thanks
Tye
(If this comment was disrespectful, please report it.)

 
9/18/2003 10:45:52 PM

Hi, I think that this code is great. I was wondering if you could help me find some information to do this project below:

Create an ASP web application that will accept a data file in Excel, XML
and/or ASCII delimited format and import the data to a SQL Server 2000
database. You can create the import files and SQL Database you need to
complete the project.
(If this comment was disrespectful, please report it.)

 
10/11/2003 4:51:15 PM

thanks karl, it is a nice workout which helped me very much.-- Great work!!!--
(If this comment was disrespectful, please report it.)

 
10/12/2003 8:58:43 PM

hi, i was wondering if your script works for multiple file uploads just like in hotmail with the files in a SELECT list and NOT with multiple INPUT type='file' objects. could you help me out in any way possible? thank you...
(If this comment was disrespectful, please report it.)

 
10/31/2003 5:04:36 PM

Fantastic code Karl! I've been using it regularly. But I've just changed servers and now I can't seem to copy any files over. After I click onto upload, the window simply hangs. IISUser settings are all included and all. Confused... pls help, many thanks in advance! :)
(If this comment was disrespectful, please report it.)

 
11/28/2003 1:46:11 PMherleybird

Is there example code to auto upload file to server with out any client input?
(If this comment was disrespectful, please report it.)

 
12/1/2003 10:03:26 AM

why am i getting
Antwoordobject error 'ASP 0157 : 80004005'

Buffer actief

/denw/any.asp, line 29
??????
(If this comment was disrespectful, please report it.)

 
1/26/2004 10:02:49 AM

webmaster@neocolorado.com
This code is incredible Karl! I had a couple of problems though..
1. I don't see where it is creating the database for the logs.. i did change the c: to d: and gave the complete path to my database folder.
2. How can i make it where the person uploading doesn't have to select the folder on my server.. i dont want them to see that info.
3. I was hoping to add this upload feature to a page of mine that has a form already on it, it takes their name, address, etc.. i needed the uploaded pic to coincide with the name,address, etc.

Thanks so much for your help!
(If this comment was disrespectful, please report it.)

 
2/6/2004 8:40:02 AM

Looks a great piece of script!
I have it apparently working, in that the log is added correctly, but the file I supposedly uploaded is not there.
The script apparently terminated correctly, and said file uploaded. How can I track down what is not happening . ANy special permissions needed?
Thanks a lot!
(If this comment was disrespectful, please report it.)

 
3/29/2004 4:25:20 PMCassidy Hunt

This code is great. I have many uses for it and can not thank you enough.
(If this comment was disrespectful, please report it.)

 
4/5/2004 11:43:27 PMNhilesh Baua

Hi Pal,
The Best things are to be free, that's true but don't u thing after being best you must have given a demo application for the newbies like us?

I'm sorry if that hurts you, but I'm really in need of one who can explain this to me.

Regards,
nbaua
(If this comment was disrespectful, please report it.)

 
7/30/2004 9:35:37 PM

Can't get this to work under any conditions. This code was written three years ago, does it perchance no longer function on current asp,vb etc?
(If this comment was disrespectful, please report it.)

 
8/20/2004 6:58:23 AM

Thanks for this great piece of code.

How can I uploaded multiple images without using multiple "input file tags"?
(If this comment was disrespectful, please report it.)

 
11/1/2004 6:10:34 PM

Great job Karl!
However, is there a limit to the size of the file upload? If yes, how can we make it larger? Thanks a lot!
(If this comment was disrespectful, please report it.)

 
12/2/2004 1:01:58 PM

Hi,

Can someone tell me the what exactly I am supposed to do run this code. I copied the code to an ASP file and named it 'saveany.asp'.
How can I check whether I have ADOX installed.

PLease reply ASAP.

Alok

please reply me at aa4@softhome.net

(If this comment was disrespectful, please report it.)

 
1/6/2005 3:30:38 PM

Do you know what steps are involved with uploading and saveing files to a remote machine (other than the web server where the script is being run from)

Bill.deering@talinternational.com
(If this comment was disrespectful, please report it.)

 
1/6/2005 3:32:09 PM

Do you know what the steps are for uploading and saving a file to a remote server, I keep getting and access permissions error?
(If this comment was disrespectful, please report it.)

 
1/13/2005 2:37:05 AM

I don't know why after I uploaded the .xls or .doc files to server, I can't open it anymore........However, it doesn't happen in .txt file. Does any one know the problem?

Many thanks.
(If this comment was disrespectful, please report it.)

 
1/28/2005 11:05:43 AMwonijack

There does appear to be a problem with the maximum file size that an be uploaded. I have been able to upload right around 3MB> Anything over that and there is a error. Other than that great coding. Anyone know how to increase the file size capabilities?
(If this comment was disrespectful, please report it.)

 
3/21/2005 10:53:31 PM

does anybody have the password for this thing?
(If this comment was disrespectful, please report it.)

 
3/24/2005 3:28:16 AM

Hi Thanks for the article that you have posted
(If this comment was disrespectful, please report it.)

 
3/30/2005 1:30:29 AM

Need help adding CDONTS piece of code to your project, that will enable me to send email with attachment once file has been uploaded.
(If this comment was disrespectful, please report it.)

 
5/19/2005 5:30:10 AMSotos - Salonica

The code is awesome and works fine on my test webserver at home, but unfortunately my webhost where my site is located doesn't give permision to write to a directory on his server so although it says upload o.k. the file is never uploaded. If anyone knows anyway around this problem mail me at sot_pap_g4@yahoo.gr
(If this comment was disrespectful, please report it.)

 
6/7/2005 6:13:14 AM

Karl,

Excellent script.

It has proved to be very useful and I am greatful for your willingness to share it!

I have found that it works really well with txt files, but when I send doc or pdf files, it reports no file was uploaded, even though the file is in the destination folder.

I think the script is finishing before the file has finished uploading. Does anyone know how to slow the script down for larger files?

Any assistance would be most welcomed.

Again, Karl, well done and thanks a lot.
(If this comment was disrespectful, please report it.)

 
6/7/2005 6:15:10 AM

Karl,

Excellent script.

It has proved to be very useful and I am
greatful for your willingness to share
it!

I have found that it works
really well with txt files, but when I
send doc or pdf files, it reports no
file was uploaded, even though the file
is in the destination folder.

I think the script is finishing before
the file has finished uploading. Does
anyone know how to slow the script down
for larger files?

Any assistance
would be most welcomed.

Again, Karl,
well done and thanks a lot
(If this comment was disrespectful, please report it.)

 
9/6/2006 6:15:40 PMLo

This is fantastic code but was wondering if you can please advise on how to send larger files over 4mb using your code.
(If this comment was disrespectful, please report it.)

 
11/2/2006 7:59:14 AMPrathap

Hi, It is working on my local computer, ie.from "http://localhost/MyWeb/saveany.asp". I saved that file in my server. When I execute saveany.asp page from my server, it is showing file has been saved in upload folder. But that file is not in that folder. Please help. Regards, Prathap
(If this comment was disrespectful, please report it.)

 
12/19/2006 8:14:12 PMFer

Exelente algoritmo, muy bien pensado hasta en los detalles.
(If this comment was disrespectful, please report it.)

 
3/16/2007 1:22:34 AMjk

To address some concerns about the file size limit. First comment out the line "On Error Resume Next". You should now get an "Operation not Allowed" error after you submit the upload with a large file. Whats the solution?! check google:
http://www.google.com/search?q=%22Operation+not+Allowed%22+request.binaryread

the 1st 4 hits explain the poblem/soln quite well.
(If this comment was disrespectful, please report it.)

 
9/11/2007 4:08:47 PMkumar

This script is excellent.
But when we need multu select option, i seleted 2nd file browser, here giving display select at least one file.
I think its not correct. Let me know solution.
(If this comment was disrespectful, please report it.)

 
9/12/2007 5:45:40 PMkumar

how to find the pixels of image when upload
(If this comment was disrespectful, please report it.)

 
9/14/2007 3:56:06 AMoogi

hi everyone. please help me how to get security password? is there anyone who will tell it to me. I really need it have worked in my local.please!!
(If this comment was disrespectful, please report it.)

 
9/14/2007 5:14:23 AMoogi

hi. here is Oogi again.
I got into security password, it`s OK!
but there is one problem,that is uploading process is done, and a message "File Uploaded" emerged. But the file is not into directory folder.
I have IIS 5.1 can it be a reason?
HELP PLEASE. I need it very much.
(If this comment was disrespectful, please report it.)

 
9/19/2007 10:01:21 PMoogi

hi. it`s oogi.
questions above are all solved OK! Thank you all. Now i have one more problem. Uploading is OK, except image quality.After uploading process that image is totally broken,can`t see the original image. Any ideas? please.
(If this comment was disrespectful, please report it.)

 
9/20/2007 8:21:37 AMnilesh

too Big and bang
(If this comment was disrespectful, please report it.)

 
2/7/2008 10:57:51 AManders

This was extremely helpful! Thanks
(If this comment was disrespectful, please report it.)

 
9/4/2009 12:38:53 PMEMiliano

Very good... I search and test a lot of ASP UploadFile... all cant use... this yes!... but... print FILE SAVING but no file is in the folder I select... why?
(If this comment was disrespectful, please report it.)

 
9/4/2009 1:12:06 PMEMiliano

Another question: how is the connection to SQL SERVER? thanks
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.