Page 1 of 2 12 LastLast
Results 1 to 40 of 78

Thread: Uploading Pictures According to the data

  1. #1

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

    Uploading Pictures According to the data

    Hi guys i got a question but i dunnoe if it fits in here.

    I am told to do a function to allow user to upload a picture according to which record they are currently adding. So the picture is tie to the records. And when user do a search the picture that is link to the record will be show....

    Any idea how to do it?
    Last edited by baby; Feb 5th, 2004 at 01:47 AM.

    Akababy.Net... Life Redefined!

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    One way is to store the picture in the database, along with other fields of the record. To know how to do that, you can check out Beacon's thread at the top of the Database Forum.

    The other method is to have a field in the record store the path of the picture file on the disk. Better still if you could allocate a specific directory to store all such pictures.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    oh... regarding the storing of pathing is there anyway i can get the code? or EG?


    Base on what you say, which of the mention 2 method is more easier to implement?

    Akababy.Net... Life Redefined!

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    i just downloaded beacon tutorial. But its based on VB.. What i am actually looking for is doing it on line. For users to upload pictures along with the database... ANy ideas where can i find the coding?

    please help

    Akababy.Net... Life Redefined!

  5. #5
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    i just downloaded beacon tutorial. But its based on VB.. What i am actually looking for is doing it on line. For users to upload pictures along with the database... ANy ideas where can i find the coding?

    please help
    VB and asp is pretty much same, you have to change the code slightly to make it work in asp.


    There are many free upload component available, and your host server should already have it installed, check it with them.

    You could do it through code, but its quite advanced coding, if you wish i could pass it to you.

    I would advice you use uploader component provided by your host or free one available for downloads.

    Hope this helps.
    [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 :

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um.. i am not really sure if my this project will be put online but lets say right now i want it to work on my IIS. I am using the build in webserver INETPUB right now.

    Is it possible? Can i get the coding for the upload of pictures to DB in asp format? cos i am not really sure how to convert VB -> asp..


    Akababy.Net... Life Redefined!

  7. #7
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    um.. i am not really sure if my this project will be put online but lets say right now i want it to work on my IIS. I am using the build in webserver INETPUB right now.

    Is it possible? Can i get the coding for the upload of pictures to DB in asp format? cos i am not really sure how to convert VB -> asp..

    I have posted this link in ASP forum many times . Here is a very good ASP tutorial. Look my post in this thread.

    http://www.vbforums.com/showthread.p...ghlight=danial

    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 :

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi danial thx for the site.. But i realise its displaying images from datbase. Do you have the link that shows how to store images in to Database as OLE object?

    Would really apperciate ur help

    Akababy.Net... Life Redefined!

  9. #9
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    hi danial thx for the site.. But i realise its displaying images from datbase. Do you have the link that shows how to store images in to Database as OLE object?

    Would really apperciate ur help
    Well you havent mentioned that you wanted to store as OLE object .

    Here you go, i have just what you looking for, hope this servers your purpose.

    Have fun

    Danial
    Attached Files Attached Files
    [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. #10

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    great~

    Let me try to see if i understand the coding haha.

    Will post back if i got any problem =)

    Thx alot danial

    Akababy.Net... Life Redefined!

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um.. danial.. there are quite a number of files inside.

    You mind telling me which are the files that is neccessary for the upload to database?

    I am not really very good with asp coding. Is it possible that u can guide me thru

    Akababy.Net... Life Redefined!

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

    Post free upload component

    if u are looking for a free upload component, i think dundas software might be able to help you there. i had a similar project 3 years ago. i had used that component to upload the files into the webserver and then copy them to respective user areas.

    when you download the component, it comes with some sample asp pages.

    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

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    thx abhijit but i dun thinki can find the software u are referring to.


    Danial - I went thru the coding u send me and i must say i dun really understand it. After some sourcing and google searching. I realise it actually can be done by storing the file name inside the database. Lets say under column pathname.

    When u a user try to upload a file the path name will appear on the the text box EG: c:\mydocuments\pictures\image.jpg. Then just by taking the image.jpg store it in the database column pathname. And when displaying the page i will get the pathname and add in my server path and display the image.

    Is it wise to do that?

    Please help

    Akababy.Net... Life Redefined!

  14. #14
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by baby
    thx abhijit but i dun thinki can find the software u are referring to.


    Danial - I went thru the coding u send me and i must say i dun really understand it. After some sourcing and google searching. I realise it actually can be done by storing the file name inside the database. Lets say under column pathname.

    When u a user try to upload a file the path name will appear on the the text box EG: c:\mydocuments\pictures\image.jpg. Then just by taking the image.jpg store it in the database column pathname. And when displaying the page i will get the pathname and add in my server path and display the image.

    Is it wise to do that?

    Please help

    Hi,
    You are right about storing the path and file name in the column of the database. Regarding the upload component, you can find plenty of other components to do the upload part for you.

    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

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    do you have anyone that i can use?

    And do you have the coding for the storing of path into database and uploading of file into a folder?

    Akababy.Net... Life Redefined!

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

    Post

    Here is the link for dundas component. You will get sample code also.

    http://www.dundas.com/other/dundasup...&body=body.htm

    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

  17. #17
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    do you have anyone that i can use?

    And do you have the coding for the storing of path into database and uploading of file into a folder?
    You can store the files/image on the database, or you can upload the files on to the server and store only the file name. You can upload the file using Component or pure code(very advanced asp code!).

    You need to decide which approach to take then i can guide you through. Its around 6.0 am here , so i'll hit the bed. I will try to explain the cod to you tomorrow when i get a chance.

    In the mean time you make up your mind about which approach to take .

    Good night. (Not sure what time zone you are in!)
    [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. #18

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Hi Danial... After some thoughts on what you said i have decided to use the store into my server folder approach.

    Which in my case i store it inside this path name "c:\inetpub\wwwroot\project\images"

    Thx for your detail explanation i am in time zone GMT +8 and its 1426hrs right now.

    The summary on what i am doing now is:
    I have to upload a picture along with a record. Its bascially a system for user to enter Project specs and project code etc... along with a picture of the project. And in my case i will do the storing of path methods as it seems much more simpler to do.


    I will list down what i will need you to guide me

    [list=1][*]Coding on uploading pictures to my c:\inetpub\wwwroot\project\images"[*]Writting the path name into the MS-DB[*]getting the path name out from the DB and displaying it.[/list=1]
    Last edited by baby; Jan 9th, 2004 at 08:28 PM.

    Akababy.Net... Life Redefined!

  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Danial u back?
    Last edited by baby; Jan 11th, 2004 at 08:28 PM.

    Akababy.Net... Life Redefined!

  20. #20
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    Danial u back?
    Hi baby,
    Sorry for the delay, i have been a bit busy with thing few things.

    Ok lets get started, is it possible to post your database? If not then do you want me to put together an example of how to upload the image file and store the path into the database and also display those image.


    I am using the free component the one posted by abhijit. So download the component and install it.

    Let me know soon, i wll put together something.
    [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 :

  21. #21

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

    thanks for replying and helping me =)

    Yup its alright i will post the database

    Really thanks for your help danial.

    Edit: Yah i just installed the upload component from dundas
    Attached Files Attached Files
    Last edited by baby; Jan 11th, 2004 at 09:58 PM.

    Akababy.Net... Life Redefined!

  22. #22
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi Baby,
    Here is something i put together quickly. It is mearly an example to get you started. Hope this helps. If you need more explanation of the code then let me know.

    Things like form validation etc i have left it to you to do.


    Hope this helps.

    Danial
    Attached Files Attached Files
    [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 :

  23. #23

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi danial... Thanks alot =)

    I will go thru the coding. Will ask u if i have any question =)

    Thx once again~

    Akababy.Net... Life Redefined!

  24. #24

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hm.. after runnin i got this error

    Error Type:
    Dundas.Upload.2 (0x80004005)
    Can't open file for writing.
    /project_virtual/danial/Process.asp, line 29



    Akababy.Net... Life Redefined!

  25. #25
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    hm.. after runnin i got this error

    Error Type:
    Dundas.Upload.2 (0x80004005)
    Can't open file for writing.
    /project_virtual/danial/Process.asp, line 29


    Make sure you have set up the folder to have write permission. What OS are you using? Are you using NTFS.

    If you change the folder permission, it should work.
    [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 :

  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    i am using windows 2000 OS

    Tried setting permission thru the Internet service manager. Changed the permission to allow all, but still have the same problem.

    Akababy.Net... Life Redefined!

  27. #27
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Are you using NTFS or FAT/FAT32 format? If its NTFS then right click on the folder and click on properties, go to security(see note) tab and add "Users" and give them write permission.

    Note : If you are using simple file sharing then you need to: Open any folder, click Tools, Folder Options, Go to View Tab, Scroll down to the end, find "Use Simple File Sharing" and uncheck it.
    [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 :

  28. #28

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    sorry didnt realise i didnt state what format the HD is.. Using fat 32.... So is it possible?

    PS:When i install the dundas component i am able to view their samples page with no problem....

    Akababy.Net... Life Redefined!

  29. #29
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    sorry didnt realise i didnt state what format the HD is.. Using fat 32.... So is it possible?

    PS:When i install the dundas component i am able to view their samples page with no problem....
    It should work fine in FAT system. I think i might know why the error is occuring

    Code:
    dim Path
    Path="c:\inetpub\wwwroot\project\images"
    Did you change the path? Make sure the path exist. Or creae the folder anywhere in the wwroot folder and change the Path variable accordingly.
    [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 :

  30. #30

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    oh yeah it worked after i changed the pathing =) thx danial

    OK i will start going thru the coding now

    Wish me luck~

    Akababy.Net... Life Redefined!

  31. #31

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Hm.. after going thru the coding. I realise it doesnt allow user to post records only. Meaning every record have to have a picture.

    How do i make it so that picture is not a must.

    sorry really new to ASP

    Akababy.Net... Life Redefined!

  32. #32
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    check the design of the table. make sure that the path is allowing a null value to be stored.

    cheers!
    abhijit

  33. #33

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    Originally posted by abhijit
    check the design of the table. make sure that the path is allowing a null value to be stored.

    cheers!
    abhijit
    yah its allowing null value all along

    Akababy.Net... Life Redefined!

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

    Talking

    Well in that case, I suggest that you need to do some validation.
    Could you please post the script that you have written so far. I will try to see what I can do.

    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

  35. #35

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    currently i am using what danial did for me to do the upload.

    See his post attached:baby.zip

    its the Process.ASP i am using the coding

    Akababy.Net... Life Redefined!

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

    Thumbs up

    Hi Baby,
    I have added some code in the process.asp. Please replace the code inside your process.asp.
    Let me know the results.

    Cheers,
    Abhijit

    VB Code:
    1. <%@ Language=VBScript %>
    2. <% Response.Buffer = true
    3.  
    4. dim Path
    5. Path="c:\inetpub\wwwroot\project\images"
    6.  
    7. 'on error resume next
    8.  
    9. dim objUpload       'instance of Uplaod control
    10. dim strMessage      'stores success/failure message sent back to main.asp
    11. dim bFileLoaded
    12. bFileLoaded = true
    13.  
    14. set objUpload = server.CreateObject("Dundas.Upload.2")
    15.  
    16. if  err.number <> 0 then
    17.     Response.Redirect "main.asp?Message=" & err.description
    18. end if
    19.  
    20. objUpload.MaxFileSize = 1048576
    21. objUpload.UseUniqueNames=false
    22.  
    23. dim NextFile
    24. set NextFile = objUpload.GetNextFile
    25.  
    26.  
    27. 'check if the file is image
    28. If InStr(1,NextFile.ContentType,"image") <> 0 Then
    29.  
    30.  
    31.     NextFile.Save path
    32.  
    33.     if err.number <> 0 then
    34.         strMessage = "The following error occurred: " & err.description
    35.     else
    36.         strMessage = "The upload operation was successfully performed"
    37.     end if
    38.  
    39.     call AddToDB
    40.     response.redirect "details.asp"
    41.  
    42.     set objUpload = nothing
    43. else
    44.     bFileLoaded = false
    45. '   response.write "File is not a valid image file"
    46. end if
    47.  
    48. %>
    49.  
    50. <%
    51. Function AddToDB()
    52. Dim Conn
    53. Dim RS
    54. Dim ConString
    55.  
    56. ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("projectDB.mdb")
    57.  
    58. Set conn = Server.CreateObject("ADODB.Connection")
    59. Set RS = Server.CreateObject("ADODB.Recordset")
    60.  
    61. Conn.Open(ConString)
    62.     RS.Open "ProjectLog", Conn, 3, 2
    63.     RS.AddNew
    64.         rs("Project_Code")=objUpload.Form("Code")
    65.         rs("Date")=objUpload.Form("Date")
    66.         rs("Company")=objUpload.Form("")
    67.         rs("Project_Coordinator")=objUpload.Form("Coordinator")
    68.         rs("Designers")=objUpload.Form("Designer")
    69.         rs("Project_Description")=objUpload.Form("Description")
    70.         if bFileLoaded = true then
    71.             rs("Picture")=Path & "\" & NextFile.FileName
    72.         end if
    73.  
    74.     RS.Update
    75.  
    76. Conn.close
    77.  
    78. set conn=nothing
    79.  
    80. End Function
    81. %>
    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

  37. #37

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    hi is it possible for you to highlight the coding you changed?

    Akababy.Net... Life Redefined!

  38. #38
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Originally posted by baby
    hi is it possible for you to highlight the coding you changed?
    Firstly, could you please tell me if its working.

    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

  39. #39

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um... no =(

    Akababy.Net... Life Redefined!

  40. #40
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by baby
    Hm.. after going thru the coding. I realise it doesnt allow user to post records only. Meaning every record have to have a picture.

    How do i make it so that picture is not a must.

    sorry really new to ASP
    No worries, i assumed user will always submit picture. I have modified the code(process.asp and details.asp). Try out the code and let me know if you have any porblem.
    Attached Files Attached Files
    [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 :

Page 1 of 2 12 LastLast

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