Hello,
I've been programming in ASP for a little while now and quite an
advanced user, but I have come across an unusual problem in which I
need assistance.
I have built my own image upload, I have two versions of the binary to
string conversion one fast, one slow because some servers use
chillisoft and therefore the append function in not accessible for a
disconnected recordset.
Slow conversion:
function b2s(varBinData, intDataSizeInBy tes)
for nindex = 1 to intDataSizeInBy tes
asc_data1 = asc_data1 & chr(ascb(midb(v arBinData,ninde x,1)))
next
b2s = asc_data1
end function
Fast conversion:
function b2s(varBinData, intDataSizeInBy tes)
const adFldLong = &H00000080
const adVarChar = 200
const adUseClient = 3
set cvs = server.createob ject("adodb.rec ordset")
cvs.CursorLocat ion = adUseClient
cvs.fields.appe nd "txt", adVarChar, intDataSizeInBy tes, adFldLong
cvs.open
cvs.addnew
cvs.fields("txt ").appendch unk varBinData
b2s = cvs("txt").valu e
cvs.close
set cvs = nothing
end function
obviously I pass the data size and data through to the function.
The problem I have is this, my image upload works find on my local
machine which is windows XP, I can upload anything using the browser,
and the file upload is fine, but as soon as I do this on a Linux box
with chillisoft I get problems. A gif image will upload correctly no
problems, but a jpeg for some reason the first 8 characters of the
file are changed and therefore the image doesn't work. Now I've done a
binarywrite through out the upload process to see if its converting
binary data correctly and it is, it just seems to corrupt first 8
characters of image when saving the file.
Save Function Used:
'*** Save Uploaded Files ***'
sub save_file(i_dat a,filepath,f_va lue)
'*** Setting path and filename ***'
filepath = filepath & f_value
savepath = server.mappath( filepath)
'*** Save File ***'
set fs = server.createob ject("scripting .filesystemobje ct")
set savefile = fs.createtextfi le(savepath, overwrite, False)
savefile.write i_data
savefile.close
set savefile = nothing
set fs = nothing
end sub
Has anyone seen this before and is able to assist me in fixing this
problem.
I've been programming in ASP for a little while now and quite an
advanced user, but I have come across an unusual problem in which I
need assistance.
I have built my own image upload, I have two versions of the binary to
string conversion one fast, one slow because some servers use
chillisoft and therefore the append function in not accessible for a
disconnected recordset.
Slow conversion:
function b2s(varBinData, intDataSizeInBy tes)
for nindex = 1 to intDataSizeInBy tes
asc_data1 = asc_data1 & chr(ascb(midb(v arBinData,ninde x,1)))
next
b2s = asc_data1
end function
Fast conversion:
function b2s(varBinData, intDataSizeInBy tes)
const adFldLong = &H00000080
const adVarChar = 200
const adUseClient = 3
set cvs = server.createob ject("adodb.rec ordset")
cvs.CursorLocat ion = adUseClient
cvs.fields.appe nd "txt", adVarChar, intDataSizeInBy tes, adFldLong
cvs.open
cvs.addnew
cvs.fields("txt ").appendch unk varBinData
b2s = cvs("txt").valu e
cvs.close
set cvs = nothing
end function
obviously I pass the data size and data through to the function.
The problem I have is this, my image upload works find on my local
machine which is windows XP, I can upload anything using the browser,
and the file upload is fine, but as soon as I do this on a Linux box
with chillisoft I get problems. A gif image will upload correctly no
problems, but a jpeg for some reason the first 8 characters of the
file are changed and therefore the image doesn't work. Now I've done a
binarywrite through out the upload process to see if its converting
binary data correctly and it is, it just seems to corrupt first 8
characters of image when saving the file.
Save Function Used:
'*** Save Uploaded Files ***'
sub save_file(i_dat a,filepath,f_va lue)
'*** Setting path and filename ***'
filepath = filepath & f_value
savepath = server.mappath( filepath)
'*** Save File ***'
set fs = server.createob ject("scripting .filesystemobje ct")
set savefile = fs.createtextfi le(savepath, overwrite, False)
savefile.write i_data
savefile.close
set savefile = nothing
set fs = nothing
end sub
Has anyone seen this before and is able to assist me in fixing this
problem.