SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb help in uploading file using text file input rather than file input

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

    hi all , I have found the following simple example to upload file to ms access
    database using plain asp. and the problem is that I want to upload without browsing the same image name ( mymap.jpg ) which always allocated in the following directory:
    (D:\MyPics\Testlevel) automatically everytime without using file input in the form rather I want just to use text input in form as follows:

    <form method="POST" name="show" enctype="multipart/form-data" action="Insert.asp">

    <td>File /td><td>
    <input type="text" name="mypic" value="D:\\MyPics\\mymap.jpg .jpg" size="40"></td></tr>
    <td> </td><td>
    <input type="submit" value="Submit"></td></tr>
    </form>


    and my adding code just gotten from this url:

    http://techrepublic.com.com/5208-103...ontent;leftCol



    as follows:

    <%
    If fileSize > 0 Then


    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open server.mappath("./db1.mdb")





    ' Recordset object
    Dim rs
    Set rs = Server.CreateObject("ADODB.Recordset")

    rs.Open "Files", conn, 2, 2

    ' Adding data
    rs.AddNew
    rs("File Data").AppendChunk mypic ' here i want to add reference to my file

    rs("name") = nameInput
    rs("age") = ageInput
    rs("address") = address
    rs.Update

    rs.Close
    Set rs = Nothing

    %>

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is the image file located on the server (where the ASP code is running) or is it located on the client computer (the person using the ASP page)?
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    My file reside in my client pc.. to upload it to server...thax in advance

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Then you can't do it ... the server has no concept of your client PC - all it knows is the data passed to it. If you pass a string with a file path then it will look IN ITS OWN FILESYSTEM for that path, and NOT on your PC ... this would otherwise be a major security flaw, so browsers do not (and never have) support this feature.
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To browse to a file on your pc, you must use this:

    <input type="file" name="mypic" size="40">


    instead of this:

    <input type="text" name="mypic" value="D:\\MyPics\\mymap.jpg .jpg" size="40">

  6. #6
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    ok ..igive it up ,I'd like to know if applicable to define default file object content point to this directory by default:
    <input type="file" name="mypic" size="40">

    value="D:\\MyPics\\mymap.jpg .jpg"

  7. #7
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can i point the value of file object field to default directory:

    <input type="file" name="mypic" size="40">

    value="D:\\MyPics\\mymap.jpg .jpg"

  8. #8
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm....

    It appears you know little about HTML or ASP. Since this is not an HTML forum it's probably better for you to move your question to another appropriate forum.

    In any case, we can't teach you those programming languages in this forum.

    Otherwise, I recommend you hire someone to get you set up for the desired functions needed.

  9. #9
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanx for ur response however just for the benefit if file resides at
    server directory ..say: c:\whatever.jpg...does it make it easy to u
    to upload as stated before in my question??

  10. #10
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Location of a source file does not make it more easy or more difficult to upload. Source Location is irrelevant as is destination location.

    Uploading is just copying a file from one location to another.

  11. #11
    SitePoint Member
    Join Date
    May 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    thank u for ur help..I just found this posthttp://www.bigresource.com/Tracker/Track-php-FCAjXMjH/
    it was helpful for me and shortcut.


Bookmarks

Posting Permissions

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