Results 1 to 4 of 4

Thread: Image Uploading (again...)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    2

    Image Uploading (again...)

    hey guys... new to this forum....
    i have read a few posts... but (as you can guess) with no success....

    well, as title says.. i have some problems with image uploading...
    i'm using MS SQL Server 2003
    coding in Visual Basic
    and running asp pages to control a the dll....

    so well the save function in the dll is:


    VB Code:
    1. Public Function SaveRecord() As Long
    2. ConnectToDb
    3. Dim strSQL As String
    4. Dim rs As ADODB.Recordset
    5.  
    6. strSQL = "Select * from tblDb"
    7.  
    8. Set rs = New ADODB.Recordset
    9. rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
    10.  
    11. rs.AddNew
    12.  
    13.  
    14.  
    15. rs!imgFile = imgFile
    16. rs!imgName = imgName
    17.  
    18.  
    19. rs.Update
    20. SaveRecord = rs!RecordId
    21. rs.Close
    22. End Function


    Then as you can guess htere is a posting page (insert.html)

    Code:
    <form id="Inserimento" method="post" action="save.asp" ENCTYPE="multipart/form-data">
    
    
    <tr><td><input type="file" name="imgFile" size="25"></td>
    <td><input tabindex=0 type=text name="imgName" size=30></td>
    <!--...continues with more boxes.. -->

    and the save.asp page which calls the dll....

    Code:
    <%@ language=VBScript %>
    <%Option Explicit %>
    <html>
    <head>
    <title>Inserimento Eventi</title>
    <link rel="stylesheet" type="text/css" href="../style.css">
    </head>
    <body>
    
    
    <%
    
    
    Dim imgFile
    Dim imgName
    
    
    imgFile = Request.Form("imgFile")
    imgName = Request.Form("imgName")
    
    
    
    Dim x
    set x = Server.CreateObject("project.class")
    
    x.GetimgFile(imgFile)
    x.GetimgName(imgName)
    
    x.SaveRecord
    
    set x = nothing
    
    'response.redirect("insert.html")
    
    %>
    
    
    </body>
    </html>

    ----------------

    displaying:

    VB Code:
    1. Public Sub SearchRecordId()
    2. Dim x As Long
    3. ConnectToDb
    4. Dim strSQL As String
    5. Dim rs As ADODB.Recordset
    6.  
    7. strSQL = "Select * from tblDb where RecordId=" & lngRecordId
    8.  
    9. Set rs = New ADODB.Recordset
    10. rs.Open strSQL, cnn, adOpenKeyset
    11.  
    12. If rs.RecordCount = 0 Then Exit Sub
    13.  
    14.  
    15. '-----------------------------
    16. imgFile = rs!imgFile
    17. imgName = rs!imgName
    18. '-----------------------------
    19.  
    20. rs.Close
    21. End Sub


    VB Code:
    1. Public Function ReturnViewImage() As String
    2. ReturnViewImage = imgFile
    3. End Function



    asp page:



    Code:
    <%
    Dim strSearch
    Dim lngRecordID
    
    lngRecordID = Request.QueryString("ID")
    
    Dim x
    set x = Server.CreateObject("Project.Class")
    x.GetRecordID(lngRecordID)
    x.SearchRecordID
    response.binarywrite(x.ReturnViewImage)
    set x = nothing
    
    
    
    %>
    the last asp page requests the id from another page (and it works great...)

    but the image is not returned... any ideas?
    should i post ALL the code?
    thx

    ac3bf1

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Image Uploading (again...)

    Could u not store the image on your local server? Then you can simple have the path instead of the image in your database? This would definitely be easier right?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Addicted Member
    Join Date
    Jul 2004
    Location
    Mumbai
    Posts
    236

    Re: Image Uploading (again...)

    hi,

    i would also go with abhijeet, to store image in server and use the path. if you are willing then try the attached one. it works fine in all of my websites..
    --Kishore...

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    2

    Re: Image Uploading (again...)

    well yeah.. i have though about that but i actualy wanted to have all in a database.... also becausse people cant touch the images if they r stored on a DB...
    while ina folder they would be easily touched, modified, renamed... etc....

    its an application for archiving small images..... no bigger than 300x300 pixels jpg formats low res.. :P


    any ideas? if u want i can post all the code in

    ac3bf1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width