Connecting Tech Pros Worldwide Help | Site Map

Uploading image in ASP

Parul Bagadia's Avatar
Familiar Sight
 
Join Date: Mar 2008
Location: India
Posts: 187
#1: Apr 10 '09
Hello,
I am making a project in ASP where am embedding VBscript in it.. Its about sth like a social networking site.. Am making it in Microsoft Expression Studio. Here i want to provide user with an option by which he can upload and view his image. my database is Oracle, what am doing is am providing user with an option of browsing; that comes automatically in Express studio.; with input box of type File,.. where you have a button written browse on it and a text box is provided.. I want that value of that path should be stored in table in oracle along with username and path of the file. amd whenecer user enters log ins the site he should be able to see the pic.
What am i getting is name of reciever is getting stored 4 times and path is not being stored even once.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <%
  4. fname = Request.Form("Text2")
  5.     'Response.write(fname)
  6.  
  7.     Response.write(File1)
  8.     photo= Request.Form("File1")    about = Request.Form("Text3")
  9.     email = Request.Form("Text10")
  10.     place  = Request.Form("Text4")
  11.     uname= Request.Form("Text5")
  12.     gender=Request.Form("Text6")
  13.     relation=Request.Form("Text7")
  14.     looking=Request.Form("Text8")
  15. hobbies=Request.Form("Text9")
  16. age=Request.Form("Text11")
  17.   Username = Session("name")    
  18.     'response.write(Username)
  19.     %><h2>Your profile has been updated successfully!!
  20.     </h2>
  21. <p>Go back to <a href="profile.asp">profile</a>.</p><%
  22. 'Build connection with database
  23.      photo=request.Form("File1")
  24. response.write(photo)
  25. set conn=server.CreateObject("ADODB.connection")
  26.     conn.ConnectionString="Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
  27.     conn.open 
  28.  
  29.     set rs = server.CreateObject ("ADODB.Recordset")    
  30.     set rs1 = server.CreateObject ("ADODB.Recordset")
  31.     set rs3 =server.CreateObject ("ADODB.Recordset")
  32. set rs2 = server.CreateObject ("ADODB.Recordset")    
  33. query2="insert into image values('"&photo&"','"&username&"')"
  34. rs2.open query2,conn query="update userdata set fname ='"& fname &"',email='"& email &"',age="& age &",gender='"& gender &"'  where uname= '"&uname &"'  "
  35.  'response.write(query)
  36.  'conn.execute query
  37.   conn.execute "commit"
  38.  'rs.movefirst
  39.  
  40. query1="update profile set about ='"& about &"',place='"& place &"',caption='"& caption &"',relation='"&relation&"',looking='"&looking&"',hobbies='"&hobbies&"' where uname= '"& uname &"'  "
  41. response.write("<br>")
  42. 'response.write(query1)
  43.   conn.execute query1
  44.  conn.execute "commit"  
  45.  'rs1.movefirst
  46.  query3="insert into image values('"&photo&"','"&Username&"')"
  47. rs3.open query3, conn
  48. %>
  49. </body>
  50. </html>
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Apr 12 '09

re: Uploading image in ASP


Parul,

Check out this article, it doesn't talk about saving it in the db, but does cover the uploading. When you get that done, post again, and I'll see if I can help you with the next step.

Jared
Reply