Page 2 of 2 FirstFirst 12
Results 41 to 78 of 78

Thread: Uploading Pictures According to the data

  1. #41

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi danial
    Thanks for your help. The code works!

    really appericate it


    Btw when i try to modify the coding to suit my function for updating. It gives me a error msg

    Error Type:
    Dundas.Upload.2 (0x80004005)
    Failed to get the boundary.
    /project_virtual/process_update.asp, line 26


    any idea what does Failed to get bounday means???

    Akababy.Net... Life Redefined!

  2. #42
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    hi danial
    Thanks for your help. The code works!

    really appericate it


    Btw when i try to modify the coding to suit my function for updating. It gives me a error msg

    Error Type:
    Dundas.Upload.2 (0x80004005)
    Failed to get the boundary.
    /project_virtual/process_update.asp, line 26


    any idea what does Failed to get bounday means???
    I have no idea, I have never used this component before, just wrote the code using the example and help file. I use pure code to upload files as some server does not allow installing component.

    Post line 25, and few lines before and after it, i might figure out the problem.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #43

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hm... i didnt modify any of the coding before line 26 and after that.. I only modify the adding of sql statment

    I think its some problem when passing variables from one page to the other.. I am attaching my 2 pages

    Search update and processupdate

    search update display result in text box and allow user to change it and i include the picture browse inputbox to also allow user to change the picture.

    Then this information is passed to processupdate to be updated into my DB.
    Attached Files Attached Files

    Akababy.Net... Life Redefined!

  4. #44
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    I stripped out the DB code, and seem to work fine for me. Not that you can not use Request.Form("ElementName") use

    objUpload.form("ElementName")

    change this following line

    lngRecordNo = Request.Form("txtcode")
    to
    lngRecordNo = objUpload.Form("txtcode")


    Try now see if that solves the problem.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #45

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hm.... after changing the coding to objupload.(txtcode) it can be successfully redirect to form.asp but the problem now is.

    The database is not changed at all.. its still the same... What might be the cause of this?

    Is it possible that objupload.(txtcode) is empty?

    Akababy.Net... Life Redefined!

  6. #46
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Yes it could be,

    do the following

    VB Code:
    1. Dim SQL
    2. Sql="SELECT * FROM projectlog WHERE Project_Code like '%" & lngRecordNo&"%'"
    3.  
    4. 'take the following two line when you have the code working
    5. response.write sql
    6. response.end
    7. ''''''''''''''''''
    8.  
    9. RS.Open sql, Conn, 3, 2

    That will tell you the sql query you are passing, will show you if u are passing the right sql.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #47

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    argh~~~ the error come back up Failed to get boundary again!

    Using objupload.(txtcode) but still have this error...

    Akababy.Net... Life Redefined!

  8. #48

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    ok after some try managed to get rid of the failed to get boundary error....

    Now the sql looks like this when i do a response.write sql

    SELECT * FROM projectlog WHERE Project_Code like '%%'

    It doesnt have any value!

    same goes for
    VB Code:
    1. rs.fields("Date")=objUpload.Form("Date")
    2.         rs.fields("Company")=objUpload.Form("Company")
    3.         rs.fields("Project_Coordinator")=objUpload.Form("Coordinator")
    4.         rs.fields("Designers")=objUpload.Form("Designer")
    5.         rs.fields("Project_Description")=objUpload.Form("Description")
    6.         rs.fields("Picture")=ImagePath

    Only imagepath have value. But those with objupload.(element) got no value..

    Akababy.Net... Life Redefined!

  9. #49
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Thats because the field names in the process_update.asp and search_update do not match !

    e.g in process_update you have txtcode

    but in search_update you are using

    objUpload("Code"). Either change the field name in process_update.asp or change it in search_update.asp to
    objUpload("txtcode")

    Do that for all the field names, and it should work




    PS: what was reason behind the boundary error?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  10. #50

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Oh...

    Yah but i got the field name right for txt code.

    For my search update i have
    VB Code:
    1. <input name="txtcode" type="text" value="<%response.write(Session("uCode"))%>" size="" maxlength="20" disabled="true">

    for my proces_update i have

    VB Code:
    1. lngRecordNo = objUpload.Form("txtcode")
    2.  
    3.  
    4. ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("projectdb.mdb")
    5.  
    6. Set conn = Server.CreateObject("ADODB.Connection")
    7. Set RS = Server.CreateObject("ADODB.Recordset")
    8.  
    9. Conn.Open(ConString)
    10. 'sql="SELECT * FROM projectlog WHERE Project_Code like '%" & lngRecordNo &"%'", Conn, 3, 2
    11. sql="SELECT * FROM projectlog WHERE Project_Code like '%" & lngRecordNo &"%'"
    12.     RS.Open sql, Conn, 3, 2
    13.     response.write sql
    14.     response.end

    the field name matches for both page. When i do the
    VB Code:
    1. response.write sql
    like you told me. The lngRecodNo is blank.. =(

    Akababy.Net... Life Redefined!

  11. #51

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    ah man... I finally fixed the post error..

    I used get instead of post in form action. They showed me that information is passed to process_updated form.

    But txtcode is not passed over. That makes me wonder.
    The culprit is disabled="true".. Seems like once u disabled a text box the information cant be passed over to other pages.

    Or at least in my case.


    Danial, is it possible to forced a resolution for the picture displayed? Eg: 500 x 400. Picture bigger that this will be scaled down. is that possible?

    Akababy.Net... Life Redefined!

  12. #52
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Yes it is, use the code from link link to get the image size. Now put a if statement like

    if lngWidth>500 then
    imgWidth=500
    end if

    if lngHeight>400 then
    imgHeight=400
    end if

    response.write "<img src='" & rs("Picture") & "' width=" & imgWidth & " height=" & imgHeight & ">"


    Or you could use javascript on client side to resize the image, but that wont look good, as when loaded the image will be shown as big and resized after few mili second.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  13. #53
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    The culprit is disabled="true".. Seems like once u disabled a text box the information cant be passed over to other pages.
    Dont use Disabled=true, use Readonly instead

    e.g
    <input name="txtcode" type="text" value="<%response.write(Session("uCode"))%>" size="" maxlength="20" Readonly>

    Also do not use Get, use post, as you are passing image data. It wont work.

    Hope this helps.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  14. #54

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    oh thx alot danial =)
    Last edited by baby; Jan 13th, 2004 at 10:50 PM.

    Akababy.Net... Life Redefined!

  15. #55

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi danial

    i went the 4guys site and downloaded the image resize coding. but dun seem to understand how does it work for my situation.

    Do you have any example that i can follow thru?

    Akababy.Net... Life Redefined!

  16. #56
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Check if ReadOnly works in Netscape Browser. I don't think it does.

    Cheers,
    Abhijit

  17. #57
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    Do you have any example that i can follow thru?
    Here you go, Make sure you specify a valid image path by changing the path name.

    VB Code:
    1. <%
    2.     dim Path
    3.  
    4.     'enter your image path
    5.     path=server.mappath("help.gif")
    6.     'path="your path here"
    7.  
    8.     dim w,h,c,strType
    9.  
    10.     if gfxSpex(Path, w, h, c, strType) = true then
    11.               response.write "Width : " & w & "<br>"
    12.               response.write "Height : " & h & "<br>"
    13.               response.write "Color : " & c & "<br>"
    14.     end if
    15. %>
    16.  
    17. <%
    18.  
    19.   function GetBytes(flnm, offset, bytes)
    20.  
    21.      Dim objFSO
    22.      Dim objFTemp
    23.      Dim objTextStream
    24.      Dim lngSize
    25.  
    26.      on error resume next
    27.  
    28.      Set objFSO = CreateObject("Scripting.FileSystemObject")
    29.  
    30.      ' First, we get the filesize
    31.      Set objFTemp = objFSO.GetFile(flnm)
    32.      lngSize = objFTemp.Size
    33.      set objFTemp = nothing
    34.  
    35.      fsoForReading = 1
    36.      Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)
    37.  
    38.      if offset > 0 then
    39.         strBuff = objTextStream.Read(offset - 1)
    40.      end if
    41.  
    42.      if bytes = -1 then     ' Get All!
    43.  
    44.         GetBytes = objTextStream.Read(lngSize)  'ReadAll
    45.  
    46.      else
    47.  
    48.         GetBytes = objTextStream.Read(bytes)
    49.  
    50.      end if
    51.  
    52.      objTextStream.Close
    53.      set objTextStream = nothing
    54.      set objFSO = nothing
    55.  
    56.   end function
    57.  
    58.  
    59.   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    60.   ':::                                                             :::
    61.   ':::  Functions to convert two bytes to a numeric value (long)   :::
    62.   ':::  (both little-endian and big-endian)                        :::
    63.   ':::                                                             :::
    64.   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    65.   function lngConvert(strTemp)
    66.      lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))
    67.   end function
    68.  
    69.   function lngConvert2(strTemp)
    70.      lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))
    71.   end function
    72.  
    73.  
    74.   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    75.   ':::                                                             :::
    76.   ':::  This function does most of the real work. It will attempt  :::
    77.   ':::  to read any file, regardless of the extension, and will    :::
    78.   ':::  identify if it is a graphical image.                       :::
    79.   ':::                                                             :::
    80.   ':::  Passed:                                                    :::
    81.   ':::       flnm        => Filespec of file to read               :::
    82.   ':::       width       => width of image                         :::
    83.   ':::       height      => height of image                        :::
    84.   ':::       depth       => color depth (in number of colors)      :::
    85.   ':::       strImageType=> type of image (e.g. GIF, BMP, etc.)    :::
    86.   ':::                                                             :::
    87.   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    88.   function gfxSpex(flnm, width, height, depth, strImageType)
    89.  
    90.      dim strPNG
    91.      dim strGIF
    92.      dim strBMP
    93.      dim strType
    94.      strType = ""
    95.      strImageType = "(unknown)"
    96.  
    97.      gfxSpex = False
    98.  
    99.      strPNG = chr(137) & chr(80) & chr(78)
    100.      strGIF = "GIF"
    101.      strBMP = chr(66) & chr(77)
    102.  
    103.      strType = GetBytes(flnm, 0, 3)
    104.  
    105.      if strType = strGIF then               ' is GIF
    106.  
    107.         strImageType = "GIF"
    108.         Width = lngConvert(GetBytes(flnm, 7, 2))
    109.         Height = lngConvert(GetBytes(flnm, 9, 2))
    110.         Depth = 2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1)
    111.         gfxSpex = True
    112.  
    113.      elseif left(strType, 2) = strBMP then      ' is BMP
    114.  
    115.         strImageType = "BMP"
    116.         Width = lngConvert(GetBytes(flnm, 19, 2))
    117.         Height = lngConvert(GetBytes(flnm, 23, 2))
    118.         Depth = 2 ^ (asc(GetBytes(flnm, 29, 1)))
    119.         gfxSpex = True
    120.  
    121.      elseif strType = strPNG then           ' Is PNG
    122.  
    123.         strImageType = "PNG"
    124.         Width = lngConvert2(GetBytes(flnm, 19, 2))
    125.         Height = lngConvert2(GetBytes(flnm, 23, 2))
    126.         Depth = getBytes(flnm, 25, 2)
    127.  
    128.         select case asc(right(Depth,1))
    129.            case 0
    130.               Depth = 2 ^ (asc(left(Depth, 1)))
    131.               gfxSpex = True
    132.            case 2
    133.               Depth = 2 ^ (asc(left(Depth, 1)) * 3)
    134.               gfxSpex = True
    135.            case 3
    136.               Depth = 2 ^ (asc(left(Depth, 1)))  '8
    137.               gfxSpex = True
    138.            case 4
    139.               Depth = 2 ^ (asc(left(Depth, 1)) * 2)
    140.               gfxSpex = True
    141.            case 6
    142.               Depth = 2 ^ (asc(left(Depth, 1)) * 4)
    143.               gfxSpex = True
    144.            case else
    145.               Depth = -1
    146.         end select
    147.  
    148.  
    149.      else
    150.  
    151.         strBuff = GetBytes(flnm, 0, -1)     ' Get all bytes from file
    152.         lngSize = len(strBuff)
    153.         flgFound = 0
    154.  
    155.         strTarget = chr(255) & chr(216) & chr(255)
    156.         flgFound = instr(strBuff, strTarget)
    157.  
    158.         if flgFound = 0 then
    159.            exit function
    160.         end if
    161.  
    162.         strImageType = "JPG"
    163.         lngPos = flgFound + 2
    164.         ExitLoop = false
    165.  
    166.         do while ExitLoop = False and lngPos < lngSize
    167.  
    168.            do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize
    169.               lngPos = lngPos + 1
    170.            loop
    171.  
    172.            if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then
    173.               lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))
    174.               lngPos = lngPos + lngMarkerSize  + 1
    175.            else
    176.               ExitLoop = True
    177.            end if
    178.  
    179.        loop
    180.        '
    181.        if ExitLoop = False then
    182.  
    183.           Width = -1
    184.           Height = -1
    185.           Depth = -1
    186.  
    187.        else
    188.  
    189.           Height = lngConvert2(mid(strBuff, lngPos + 4, 2))
    190.           Width = lngConvert2(mid(strBuff, lngPos + 6, 2))
    191.           Depth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8)
    192.           gfxSpex = True
    193.  
    194.        end if
    195.  
    196.      end if
    197.  
    198.   end function
    199.   %>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  18. #58
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by abhijit
    Check if ReadOnly works in Netscape Browser. I don't think it does.

    Cheers,
    Abhijit
    Depends on what version of Netscape you are using. Older version of NS does not support ReadOnly, but neither does it support Disabled! It is supported in newer version of NS. Opera and Mozilla supports it as far as i know.

    ReadOnly is a valid property as described in the W3 HTML Specification.

    http://www.w3.org/TR/html401/interac...#adef-readonly

    When the disabled property is used in any form element the content of the field is not submited.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  19. #59

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    thanks alot danial. Will start to go thru the coding. And be prepared to be irritated by my question later on haha


    Oh and thx for the info on the disabled property. Now i know the disabled is a killer!

    Akababy.Net... Life Redefined!

  20. #60

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Danial! i just wanna say you are really very helpful...

    I just managed to do the scaling. If not for ya, i would not have learn so much about uploading image...

    If in anychange you need my help just let me know =)

    I will certainly try my best to help ya =)

    My icq is #73247670

    Akababy.Net... Life Redefined!

  21. #61
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    Danial! i just wanna say you are really very helpful...

    I just managed to do the scaling. If not for ya, i would not have learn so much about uploading image...

    If in anychange you need my help just let me know =)

    I will certainly try my best to help ya =)

    My icq is #73247670
    Thanks for the compliment . We are all here to help and learn from each other.

    I think teaching some one else is one of the greate way to learn...

    Sorry stopped using ICQ for about 3 years.

    Good luck.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  22. #62

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    yeah we are all here to help each other =)

    alright no problem drop me a email if you want to contact me

    Akababy.Net... Life Redefined!

  23. #63

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Danial - Remeber that time u helped me on storing the pathing of where the picture is stored into the Database?

    It stored a path EG: c:\inetpub\pictures\upload\123.gif

    This is fine when i run the asp on my computer.

    But when i tried accessing the asp pages from other computer. They cant find the image file. Becos its pointing to c:\inetpub\pictures\upload\123.gif but this file is not on their computer.

    Anyway to fix this????

    Akababy.Net... Life Redefined!

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

    Exclamation

    Store the images on the webserver and not on your local pc.

    Also use Server.MApPath to get the relative path of the image.

    Regards,
    Abhijit
    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

  25. #65

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi abhijit can u give me a example how to use the server.MapPath?

    But right now my this program is done on my this PC and i dun think my supervisor would have access to the webserver in our school.

    Akababy.Net... Life Redefined!

  26. #66
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    hi baby,
    server.mappath can be used to map absolute paths to relative paths. Check This Link For More

    u are developing your program on your pc, but you need to host it on a web-server so that everyone can access it.

    How are you accessing the asp from another pc? Where is the location of the webserver?

    Cheers,
    Abhijit
    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

  27. #67

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Originally posted by abhijit
    hi baby,
    server.mappath can be used to map absolute paths to relative paths. Check This Link For More

    u are developing your program on your pc, but you need to host it on a web-server so that everyone can access it.

    How are you accessing the asp from another pc? Where is the location of the webserver?

    Cheers,
    Abhijit

    Oh i am accessing it by just typing the IP of my computer and the path of where my project is held.

    EG 172.xxx.xx.23/project/index.asp

    in this case anyway to fix this?

    Akababy.Net... Life Redefined!

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

    Arrow

    Ok. My suggestion to you is store the mapped path inside the database instead of the absolute path.

    Then when your asp reads the path, it will show the image correctly on your friend's pc as well.

    Check it out.

    Cheers,
    Abhijit
    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

  29. #69

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hm.. I think only danial could help me on this... Cos he did the componenent for upload for me..

    I still dunnoe how i am going to put relative pathing.

    currently theres a column in my database that store the picture pathing. Right now its storing absolute pathing..

    EG: C:\inetpub\wwwroot\project\pictures\upload\emilia123.gif

    i tried changing it to pictures\upload\emilia123.gif or project\pictures\upload\emilia123.gif but cant work =(

    Akababy.Net... Life Redefined!

  30. #70
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by baby

    currently theres a column in my database that store the picture pathing. Right now its storing absolute pathing..

    EG: C:\inetpub\wwwroot\project\pictures\upload\emilia123.gif

    i tried changing it to pictures\upload\emilia123.gif or project\pictures\upload\emilia123.gif but cant work =(
    Change it to

    pictures/upload/emilia123.gif
    Notice the difference in the slash. And then check it out.

    Cheers,
    Abhijit
    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

  31. #71

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    after some tweaking i finally got it able to work


    But i did this by hardcoding

    this is what i did

    server.MapPath("pictures\upload\ddtree.gif")

    it works for this.. But this is not what i wanted cos i will be taking the path value from my database


    i want it to be something like this

    server.MapPath(rs.fields("Picture")) but i get a type mismatch error

    cani noe the excat syntax?

    Akababy.Net... Life Redefined!

  32. #72
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by baby
    after some tweaking i finally got it able to work


    But i did this by hardcoding

    this is what i did

    server.MapPath("pictures\upload\ddtree.gif")

    it works for this.. But this is not what i wanted cos i will be taking the path value from my database


    i want it to be something like this

    server.MapPath(rs.fields("Picture")) but i get a type mismatch error

    cani noe the excat syntax?
    your field contains the c:\ so its giving an error.
    when you store you will have to do a server.mappath
    that ways everyone accessing the page will be able to see the pictures.

    -abhijit

  33. #73

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um.. can u give me a more detail explanation=) sorry cant really understand what you are trying to say

    Akababy.Net... Life Redefined!

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

    Cool

    Detailed Explanation follows:
    +++++++++++++++++++++++++++++
    When you upload the image, you are storing the image in your local drive.
    You are also storing the same absolute path of the drive.
    This is causing this path to be displayed in property of the img tag.
    <img>c:\localpath\yourimage.jpg</img>

    Instead of storing the local path of the image, my suggestion to you is to
    store the relative path in the database.

    So when your webpage is accessed through any pc, the path displayed in the localpath will be
    <img>/localpath/yourimage.jpg</img>

    Am I being clear or do you need some more explanations?

    Cheers,
    Abhijit

  35. #75

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    ok this i know. Cos i already did it


    But what i am puzzled right now is this

    guys i need your here pls tell me what is wrong with this statement

    My Picture column contain this picture\upload\123.gif


    VB Code:
    1. path=rs.fields(picture)
    2.  
    3. server.mappath(path)//error line

    if i do the above code i will get a type mismatch error


    VB Code:
    1. path="picture\upload\123.gif"
    2.  
    3. server.mappath(path)

    but if i do this then every thing turns out fine...

    What is wrong with this!??

    the above is taken off my post at here http://www.vbforums.com/showthread.p...hreadid=277869

    Akababy.Net... Life Redefined!

  36. #76

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    ok i think i know whats the problem already

    Cos some of my picture column is empty

    and i think server.mappath can handle empty string. Thats y the type mismatch error..



    Ok any way to solve this??So that i can handle empty string?

    Akababy.Net... Life Redefined!

  37. #77

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    ok i solved it.. By doing another way around...By putting default value into my picture column... Thx all for the help.....

    Akababy.Net... Life Redefined!

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

    Thumbs up

    Originally posted by baby
    ok i solved it.. By doing another way around...By putting default value into my picture column... Thx all for the help.....
    way to go baby!
    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

Page 2 of 2 FirstFirst 12

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