p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Re: proasp_codeclinic digest: February 28, 2001


Message #1 by "Pawan Kinger" <pa****inger@h...> on Thu, 01 Mar 2001 06:22:28
Your problem while uploading a file and storing some information to database 
is genuine. Because we cannot read data from client in both binary 
mode(which is required to upload a file) and ASCII mode(to read simple text 
data from text fields etc). So you have to modigy script & read in Binary 
mode using the object of class (uploading) i'm sending scriplet, which might 
solve ur problem if not do write to me:

''-----------------the code goes like this -----------------------

Dim objUpload

If Request.TotalBytes > 0 Then
	Set objUpload = New clsUpload

if objUpload.Files.Item(0).FileName>"" then
   'for uploading image1

	   objUpload.Files.Item(0).Save server.MapPath("rel. path where to store 
image ")
	image = objUpload.Files.Item(0).FileName
end if
end if

firstname=trim(objUpload.Form.Item(0))
lastname=trim(objUpload.Form.Item(1))


rs.AddNew
'required field
rs("firstname")=firstname

if lastname<>"" then
rs("lastname")=lastname
end if

'update database
rs.update

'-----This uploads your image and updates your database -------------
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


  Return to Index