473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Image upload problem with jpegs

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, intDataSizeInBytes)
for nindex = 1 to intDataSizeInBytes
asc_data1 = asc_data1 & chr(ascb(midb(varBinData,nindex,1)))
next
b2s = asc_data1
end function

Fast conversion:

function b2s(varBinData, intDataSizeInBytes)
const adFldLong = &H00000080
const adVarChar = 200
const adUseClient = 3
set cvs = server.createobject("adodb.recordset")
cvs.CursorLocation = adUseClient
cvs.fields.append "txt", adVarChar, intDataSizeInBytes, adFldLong
cvs.open
cvs.addnew
cvs.fields("txt").appendchunk varBinData
b2s = cvs("txt").value
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_data,filepath,f_value)
'*** Setting path and filename ***'
filepath = filepath & f_value
savepath = server.mappath(filepath)

'*** Save File ***'
set fs = server.createobject("scripting.filesystemobject")
set savefile = fs.createtextfile(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.
Jul 19 '05 #1
0 2343

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ok | last post by:
Hello, Q: How do I get image width and height before uploading an image? This because, I want to restrict people uploading huge files. Thanks in advance
3
by: Phil W | last post by:
I need to install a component which will upload and resize images (jpegs). I don't need too many bells and whistles but would like one which is reasonably good at keeping the file size low (or lets...
1
by: mbberkowitz | last post by:
I should begin by thanking Mr. Lebans for all the helpful stuff he's posted on his site. I've incorporated code from his A2KLoadSaveJpegVer9.mdb into my database so that I could move jpegs...
2
by: Tim T | last post by:
Hi, Could someone please point to to a tutorial / code for dynamically resizing images on upload, THEN saving to disk on the webserver. I need users to be able to upload images to my server, but...
4
by: LT.Ang | last post by:
I am developing an application that possibly opens very large images - bmp, jpeg, tiff. I have 2 questions: Language: C#, VS .NET 2003. 1. When the program opens a BMP image, the amount of...
2
by: Anthony2oo5 | last post by:
Image optimization Emergency lol Hey guys. I have a image hosting website that seems to have taken off over the past 2 days and jumped from 6GB per day, to 25 GB and rising. I was wondering if...
6
by: William Gill | last post by:
I have found a couple of sites that allow a visitor to upload an image and the site returns either the "average color", or a palette of colors. Several of them use PHP to accomplish this. I have...
2
by: Tim Streater | last post by:
The following test page is intended to allow the user to choose an image file, and then display it. It works as expected in Safari 3.1.1, FF 2.0.0.14 (Mac), and IE7 (XP). But, it fails in FF...
13
by: seegoon | last post by:
Hi all. So: I've put together a page, in which I want several clickable image maps. I've put those together already. The problem with image maps is that they're not very intuitive, so users don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.