aspUpload query - can I do this?

Results 1 to 2 of 2

Thread: aspUpload query - can I do this?

  1. #1
    Join Date
    Dec 1969

    Default aspUpload query - can I do this?

    I have a form allowing a user to upload a photo and description of the product the photo relates to. <BR><BR>I am using ASPUpload to upload the file to the server. It&#039;s working fine, but I would also like the user to be able to upload a thumbnail of the photo too. <BR><BR>At the moment I have this as the basis for my process page which takes the form contents and puts the contents into the database (using Access2000 and IIS on win2k). <BR><BR>I have shown my response page below. That works fine. <BR><BR>&#060;%<BR> Set Upload = Server.CreateObject("Persits.Upload")<BR><BR> &#039; Capture files<BR> Upload.Save "c:inetpubwwwrootluckyimages"<BR><BR> &#039; Obtain file object<BR> Set File = Upload.Files("THEFILE")<BR><BR>For Each File in Upload.Files<BR><BR> If File.ImageType = "UNKNOWN" Then<BR> Response.Write "This is not an image."<BR> Response.End<BR> End If<BR><BR> Strmsg = server.htmlencode(Upload.Form("Item_Desc"))<BR><BR > ID = Upload.Form("ID")<BR><BR> item_title = server.htmlencode(newstr(Upload.Form("item_title") ))<BR><BR> item_MinOrder = server.htmlencode(newstr(Upload.Form("item_MinOrde r")))<BR><BR> item_colours = server.htmlencode(newstr(Upload.Form("item_colours ")))<BR><BR> sql = "INSERT INTO photos_master (photoName, photoTitle, photoDesc, photoMinOrder, photoColours, catID, main_width, main_height) VALUES (&#039;"<BR> sql = sql & File.Filename & "&#039;,&#039;"<BR> sql = sql & item_title &"&#039;,&#039;"<BR> sql = sql & Strmsg &"&#039;,&#039;"<BR> sql = sql & item_MinOrder &"&#039;,"<BR> sql = sql & item_colours &","<BR> sql = sql & item_cat &","<BR> sql = sql & File.ImageWidth & ","<BR> sql = sql & File.ImageHeight & ")"<BR><BR> set FILE = oConn.Execute(sql)<BR><BR>Next<BR><BR>oConn.Close: set oConn=nothing<BR>%&#062;<BR><BR>That works fine. But I was wanting to add another form field, and just add a few lines of SQL which take the file name of the thumbnail and its dimensions and add them to the db, as well as uploading the thumbnail at the same time as the main photo. <BR><BR>Am I right in thinking that this is a load of rubbish what I&#039;m writing and that basically the user will need to do a 2 step process, one page to upload the thumbnail, and another page to upload the main photo?<BR><BR>Thanks<BR><BR>Jim

  2. #2
    Join Date
    Dec 1969

    Default sure can

    but I&#039;m not sure you would want to. There is a component called ASPJpeg out there that allows you to resize an image on the fly (essentially make a thumbnail image from the uploaded file dynamically).<BR>BUT.. you CAN do it using two image upload fields. See that part of code that says "For Each File in Upload.Files"? That will loop through every form field of type "file" and do something with them. To distinguish between the two fields (main image, thumbnail) just grab the form field name.<BR>HTH!<BR>~~Chaotix

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts