Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 26th, 2007, 04:18 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default Uploading multiple images

I'm using the asp upload component to upload multiple images. I have 5 images - if I upload an image 3 for example, then it assumes the place of image 1, if I upload image 4, then it assumes the place of image 2 - so they don't reside in the postion that I ask them to - here is my code: (the code inserts the product name into an MS SQL Server db)

    For i = 1 to Count
        'Obtain File object representing uploaded file
         Set File = Upload.Files(i)

        If File.ImageType <> "JPG" Then
<script language="JavaScript">
window.alert("The Selected Image has to be a JPEG Image!");
        end if

                        Set jpeg = Server.CreateObject("Persits.Jpeg")
                        Set jpeg2 = Server.CreateObject("Persits.Jpeg")


                        theWidthRatio = 150/jpeg.OriginalWidth
                        if CDbl(theWidthRatio) < 1 then
                            jpeg.Width = 150
                            jpeg.Height = CInt(jpeg.OriginalHeight * theWidthRatio)
                            jpeg.Save server.Mappath("../../images/upload") & "/small_" & File.ExtractFileName
                            jpeg.Save server.Mappath("../../images/upload") & "/small_" & File.ExtractFileName
                        end if

                        theBigWidthRatio = 500/jpeg2.OriginalWidth
                        if CDbl(theBigWidthRatio) < 1 then
                            jpeg2.Width = 500
                            jpeg2.Height = CInt(jpeg2.OriginalHeight * theBigWidthRatio)
                            jpeg2.Save server.Mappath("../../images/upload") & "/big_" & File.ExtractFileName
                            jpeg2.Save server.Mappath("../../images/upload") & "/big_" & File.ExtractFileName
                        end if

                        set jpeg = nothing
                        set jpeg2 = nothing

        if i = 1 then
            rs("ProductImage") = File.ExtractFileName
        elseif i = 2 then
            rs("ProductImage2") = File.ExtractFileName
        elseif i = 3 then
            rs("ProductImage3") = File.ExtractFileName
        elseif i = 4 then
            rs("ProductImage4") = File.ExtractFileName
        elseif i = 5 then
            rs("ProductImage5") = File.ExtractFileName

        end if

can someone explain to me why this is happening?



Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
uploading images with PHP Adam H-W PHP How-To 1 May 30th, 2006 10:11 AM
uploading, retrieving images kourosh Classic ASP Basics 2 September 17th, 2005 04:33 PM
uploading Images.. Pallav Servlets 4 November 1st, 2004 05:34 AM
Uploading images to a database vivi Classic ASP Basics 3 October 30th, 2003 10:14 PM

All times are GMT -4. The time now is 07:54 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.