Professional Web Applications Themes

HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type - ASP

I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data" WIDTH=100%> <INPUT Type="file" name="UpFileName" STYLE="{Width:400px}"><BR> I have the following ASP code server side .... AllDataB = Request.BinaryRead() AllData = ConvertToStringFromByte(AllDataB) AllDataFile = pGetRequestItem(AllData....) ' THIS INSTRUCTION FIND FILE BINARY DATA..... I need to transform SAFE ARRAY AllDataB in a Vb string because it's necessary for me to find Header info and because AllDataB doesn't contain only FILE BINARY DATA but other informations. Now I want to insert DIRECTLY File Binary Data (in the variable AllDataFile) in a Sql Server Image field without writing ...

  1. #1

    Default HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type

    I have the following problem:

    I have the following form client side:

    <FORM.......>

    <FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data"
    WIDTH=100%>
    <INPUT Type="file" name="UpFileName" STYLE="{Width:400px}"><BR>

    I have the following ASP code server side ....

    AllDataB = Request.BinaryRead()

    AllData = ConvertToStringFromByte(AllDataB)

    AllDataFile = pGetRequestItem(AllData....) ' THIS INSTRUCTION FIND FILE
    BINARY DATA.....

    I need to transform SAFE ARRAY AllDataB in a Vb string because it's
    necessary for me to find Header info and because AllDataB doesn't contain
    only FILE BINARY DATA but other informations.

    Now I want to insert DIRECTLY File Binary Data (in the variable AllDataFile)
    in a Sql Server Image field without writing AllDataFile to a local file
    using the FileSysteObject.

    If I write:

    Rs("ImageField").AppendChunk AllDataFile

    IT DOESN'T WORK: the data format is UNICODE. And If I open the file the
    format is UNRECOGNIZED.

    Is There a Mode to insert directly data from BinaryRead to Sql Server Image
    data type ?

    If I write data from binaryread to a local file with FILESYSTEMOBJECT and I
    read it with ADODB.STREAM and I write ADODB.STREAM content to SQL SERVER
    IMAGE DATA TYPE it works but it's VERY VERY slow with large files.

    Thanks Rob


    Roberto Guest

  2. #2

    Default RE: HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type

    Hi Rob,

    You may try following code to see if it will help:

    Set objADO = CreateObject("ADODB.Stream")
    objADO.Open
    objADO.Type = 1
    objADO.Write Request.BinaryRead(Request.TotalBytes)

    Luke
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    台灣微軟技術處支援部 Guest

  3. #3

    Default Re: HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type

    Ok. But Request.BinaryRead doesn't contain only binary data of FILE but
    other information : for example
    CONTENT - TYPE
    CONTENT - DISPOSITION....

    etc etc.....
    Now I must position at the begin of Binary Data.....I have tried with INSTRB
    and MIDB but if I call INSTRB with Binary Data it goes in crash.

    Rob.

    ""台灣微軟技術處支援部"" <lukezhanonline.microsoft.com> wrote in message
    news:VanD914kDHA.2088cpmsftngxa06.phx.gbl...
    > Hi Rob,
    >
    > You may try following code to see if it will help:
    >
    > Set objADO = CreateObject("ADODB.Stream")
    > objADO.Open
    > objADO.Type = 1
    > objADO.Write Request.BinaryRead(Request.TotalBytes)
    >
    > Luke
    > Microsoft Online Support
    >
    > Get Secure! [url]www.microsoft.com/security[/url]
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >

    Roberto Guest

  4. #4

    Default Re: HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type

    Hi Rob,

    To remove the redundant data, you may refer to following article for third
    party solution or pure script solution:

    [url]http://www.aspfaq.com/show.asp?id=2189[/url]

    Addtionally, there is also a way with MSXML:

    [url]http://www.15seconds.com/issue/010522.htm[/url]

    Hope this help,

    Luke
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    MSFT Guest

Similar Threads

  1. Mimic Input Type=File server to server
    By garbagecatcher in forum ASP
    Replies: 8
    Last Post: June 22nd, 08:42 PM
  2. Replies: 2
    Last Post: October 16th, 08:29 AM
  3. input type=file
    By Paul Moffitt in forum ASP
    Replies: 4
    Last Post: August 28th, 06:40 PM
  4. Is it possible to test an uploaded file to check the type?
    By Dan Anderson in forum PHP Development
    Replies: 11
    Last Post: July 19th, 06:22 AM
  5. Replies: 0
    Last Post: July 12th, 05:38 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139