473,586 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, 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.
Jul 19 '05 #1
0 2365

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

Similar topics

5
17472
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
3870
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 me set the compression options). There's quite a few out there, has anyone any recommendations? Thanks, Phil
1
1436
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 directly from BLOBs in my database to Image controls and vice-versa -- without having to use temporary files. The problem I'm having is that some of...
2
2357
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 they will not be aware of optimising graphics for the web, if someone uploads a 300k 640x480 jpeg for example, i need to be able to shrink it down to...
4
3457
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 memory used seems to be larger for BMP files than JPEGs with the same pixel dimensions. For example, 5200 x 5000 pixels image -- increase in Mem Usage...
2
1513
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 there is a way to help lower this bandwidth problem. I wanted to optimise images that people upload. I found a function on this webpage that says...
6
1908
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 requested the source code, but have not gotten a response (even though one site states "source code available on request"). It is obvious that they...
2
8319
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 2.0.0.14 (Win-XP) - the image doesn't appear. The error console shows no errors and Page Info, under the media tab, shows no loaded image (in contrast...
13
5346
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 really expect the image to be clickable and accordingly won't even try to. The solution is to have the image highlight whenever the mouse travels over...
0
7912
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.