Image uploading help


need some help in this issue i have used this code earlier and it works fine its giving an error for the first time

here is what i do i get some data and images from html page and then upload the images in sql server the format in table is image so i store the image directly in the table and the corresponding data so what i used to do earlier is have a loader.asp file included into my asp page here is the code for the confirm.asp page

Code: and here is the code for the loader.asp page which i have included in the confirm.asp page
Code: 0 Then Dim binData binData = Request.BinaryRead(Request.TotalBytes) getData binData End If End Sub Public Function getFileData(name) If dict.Exists(name) Then getFileData = dict(name).Item("Value") Else getFileData = "" End If End Function Public Function getValue(name) Dim gv If dict.Exists(name) Then gv = CStr(dict(name).Item("Value")) gv = Left(gv,Len(gv)-2) getValue = gv Else getValue = "" End If End Function Public Function saveToFile(name, path) If dict.Exists(name) Then Dim temp temp = dict(name).Item("Value") Dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") Dim file Set file = fso.CreateTextFile(path) For tPoint = 1 to LenB(temp) file.Write Chr(AscB(MidB(temp,tPoint,1))) Next file.Close saveToFile = True Else saveToFile = False End If End Function Public Function getFileName(name) If dict.Exists(name) Then Dim temp, tempPos temp = dict(name).Item("FileName") tempPos = 1 + InStrRev(temp, "\") getFileName = Mid(temp, tempPos) Else getFileName = "" End If End Function Public Function getFilePath(name) If dict.Exists(name) Then Dim temp, tempPos temp = dict(name).Item("FileName") tempPos = InStrRev(temp, "\") getFilePath = Mid(temp, 1, tempPos) Else getFilePath = "" End If End Function Public Function getFilePathComplete(name) If dict.Exists(name) Then getFilePathComplete = dict(name).Item("FileName") Else getFilePathComplete = "" End If End Function Public Function getFileSize(name) If dict.Exists(name) Then getFileSize = LenB(dict(name).Item("Value")) Else getFileSize = 0 End If End Function Public Function getFileSizeTranslated(name) If dict.Exists(name) Then temp = LenB(dict(name).Item("Value")) If temp 0 inStrByte = InStrB(currentPos, rawData, separator) mValue = inStrByte - currentPos If mValue > 1 Then value = MidB(rawData, currentPos, mValue) Dim begPos, endPos, midValue, nValue Dim intDict Set intDict = Server.CreateObject("Scripting.Dictionary") begPos = 1 + InStrB(1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) nValue = endPos Dim nameN nameN = MidB(value, begPos, endPos - begPos) Dim nameValue, isValid isValid = True If InStrB(1, value, stringToByte("Content-Type")) > 1 Then begPos = 1 + InStrB(endPos + 1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) If endPos = 0 Then endPos = begPos + 1 isValid = False End If midValue = MidB(value, begPos, endPos - begPos) intDict.Add "FileName", trim(byteToString(midValue)) begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type:")) endPos = InStrB(begPos, value, ChrB(13)) midValue = MidB(value, begPos, endPos - begPos) intDict.Add "ContentType", trim(byteToString(midValue)) begPos = endPos + 4 endPos = LenB(value) nameValue = MidB(value, begPos, ((endPos - begPos) - 1)) Else nameValue = trim(byteToString(MidB(value, nValue + 5))) End If If isValid = True Then intDict.Add "Value", nameValue intDict.Add "Name", nameN dict.Add byteToString(nameN), intDict End If End If currentPos = lenSeparator + inStrByte Wend End Sub End Class Private Function stringToByte(toConv) Dim tempChar For i = 1 to Len(toConv) tempChar = Mid(toConv, i, 1) stringToByte = stringToByte & chrB(AscB(tempChar)) Next End Function Private Function byteToString(toConv) For i = 1 to LenB(toConv) byteToString = byteToString & Chr(AscB(MidB(toConv,i,1))) Next End Function %> its throwing an error in loader.asp page like this

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'MidB'

/store/mainwebsite/Loader.asp, line 134

and line 134 is this one

separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

can someone tell me whats it related with

i am uploading 3 images at one time

Posted On: Friday 26th of October 2012 04:16:08 AM Total Views:  716
View Complete with Replies

Related Messages:

not upload duplicate image name   (390 Views)
Yes different users can post images with the same name and they should be renamed as you state. However you can not upload an image with the same name if you have already done so and give msgbox that duplicate image name pls check image name and image size is not larger then 13kb. You got it
Precaching images   (450 Views)
I am precaching images from my database and I am using javascript to do this. Now how do I assign my images from the database into an Array. I believe that I am on the right track with this, just not positive about the variables I am assigning. Code: var Images = new Array() for (i=0; i < document.PrtImage.length; i++){ Images[i] = PrtImage; } PrtImage is the name of the field the images are stored in.
Database image custom size and hyperlink   (424 Views)
Code: ok. my fields in my database (out1,out2,in1,in2,in3,in4) they all contain actual filenames such as (house_out1.jpg,house_out2.jpg,house_in1.jpg,house _in2.jpg,house_in3.jpg,house_in4.jpg) using the above img src method i can display the images for the chosen record.. 1. i need to alter the above code to set the image size to 100,100 2. i need to make each image being displayed be a link to the filename itself (which is basically the field value of the record). so when they click on the image, it will open that image in its full size. how can this be done
Click image, ADO Stream?   (484 Views)
I'm looking to have an image (say, icons for a particular document) and when it is clicked on, I would like the "Open/Save/Cancel" dialogue to open up. I was told using an ADO data stream was the way to go, making the app an unknown so the dialogue opens: Code: Dim FileName Dim FullFileName FileName = "MyWordDocument.doc" FullFileName = "C:\Webfiles\MyWordDocument.doc" Response.ContentType = "application/x-unknown" Response.Addheader "Content-Disposition", "attachment; filename=" & chr(34) & FileName & chr(34) Response.Binarywrite GetBinaryFile(FullFileName) Function GetBinaryFile(ByVal FileSpec) Const adTypeBinary = 1 Dim objStream Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open() objStream.Type = adTypeBinary objStream.LoadFromFile (FileSpec) GetBinaryFile = objStream.Read() Set objStream = Nothing End Function Is there a better way to do this Also, I grab the file name from a SQL query which is then populated to a datagrid - the image name/etc is populated dynamically - how is this done in ASP Is that with an anchor tag Code:
copy image to clipboard   (357 Views)
! I need help... I need to disable the right click "copy" option on an ASP page and add a Copy button that will do the same thing. I was able to disable the Copy when a user right clicks, but I need help copying the image to the clipboard when they click a button. Please help!
Finding and renaming image.   (331 Views)
Im running this via a vbs file. Heres what im trying to do, I have mssql databse full of about 15,000 item ID codes. For Example of the ID Code: The first 2 sometimes 4 letters represents the distributor name, the numbers are the item number and BX for example means Box. DJ3726 DJ3847BX DJ3743CD PD2374 PD2334 PD4334BX And I have about 15,000 images from my distributrs that mostly match up to the actual ID number, but still a lot dont match up because of a small extra letter like BX Or somehting like that. So what ive done was write a code that Splits out the Manufature code for example DJ from DJ3726BX, and also the same for the item ID 3726 from DJ3726BX, So when I put thos to together I get just the manufature name and ID code instead of the extra crap I dont need. And now I take just the Manufacutre name and ID and looping through my database and all of the (images via File Scripting Object). Then I check to see if the manufacure code and ID is in the item name. For Example Check if DJ74637 IS In: DJ74637BX.GIF Then if it finds a match it gos and renames the gif for me. And it loops through untill its done. My problem is that it just doesnt work, no errors no anything it just doesnt pick up any images when I can visualy go through my self and find some matchs. Heres my code that I came up with so far Code: Set rsItems = CreateObject("ADODB.Recordset") strsql = "Select item_ID from tb_inventory" strsql, adocon Do while not rsitems.EOF strmfg = left(rsitems("item_ID"),5) strmfg = replace(strmfg,"0","") strmfg = replace(strmfg,"1","") strmfg = replace(strmfg,"2","") strmfg = replace(strmfg,"3","") strmfg = replace(strmfg,"4","") strmfg = replace(strmfg,"5","") strmfg = replace(strmfg,"6","") strmfg = replace(strmfg,"7","") strmfg = replace(strmfg,"8","") strmfg = replace(strmfg,"9","") stridnum = replace(rsitems("item_ID"),"a","") stridnum = replace(rsitems("item_ID"),"b","") stridnum = replace(rsitems("item_ID"),"c","") stridnum = replace(rsitems("item_ID"),"d","") stridnum = replace(rsitems("item_ID"),"e","") stridnum = replace(rsitems("item_ID"),"f","") stridnum = replace(rsitems("item_ID"),"g","") stridnum = replace(rsitems("item_ID"),"h","") stridnum = replace(rsitems("item_ID"),"i","") stridnum = replace(rsitems("item_ID"),"j","") stridnum = replace(rsitems("item_ID"),"k","") stridnum = replace(rsitems("item_ID"),"l","") stridnum = replace(rsitems("item_ID"),"m","") stridnum = replace(rsitems("item_ID"),"n","") stridnum = replace(rsitems("item_ID"),"o","") stridnum = replace(rsitems("item_ID"),"p","") stridnum = replace(rsitems("item_ID"),"q","") stridnum = replace(rsitems("item_ID"),"r","") stridnum = replace(rsitems("item_ID"),"s","") stridnum = replace(rsitems("item_ID"),"t","") stridnum = replace(rsitems("item_ID"),"u","") stridnum = replace(rsitems("item_ID"),"v","") stridnum = replace(rsitems("item_ID"),"w","") stridnum = replace(rsitems("item_ID"),"x","") stridnum = replace(rsitems("item_ID"),"y","") stridnum = replace(rsitems("item_ID"),"z","") strsearch = strmfg & stridnum Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strRootFolder) For Each objFile in objFolder.Files splitname = Split(objFile.Name, ".") strimagepath = strRootFolder & objFile.Name strextname = objFSO.GetExtensionName(strimagepath) if instr(splitname(0),strsearch) = 1 then objFSO.MoveFile strimagepath,"C:\fix\thumb\" & rsitems("Item_ID") & ".gif" end if next set objfso = nothing set objFolder = nothing rsitems.movenext Loop I hope I explained whats going on here well enough, Let me know.
Bold image border   (367 Views)
hihi.. how i can bold the image border when onclick takes palce jamescw
How to upload a image or a file to the Server   (412 Views)
Dear Frnds, i want to know the Coding for to give a Facility to the User, Upload his file to the Server...Like Photo's Please Reply me.
Populate images depending on listbox value   (412 Views)
i have learned how to populate a webpage with images from a database. however, i would like to go a little deeper: i would like to create a recordset (in dreamweaver) with a drop-down list of my product lines: product line A product line B etc etc this is not a problem. i can do this. however, once the user has selected from the list, i would like the corresponding images to be displayed in the webpage. i am not sure how to go about this. tips for doing this in dreamweaver would be excellent. any ideas
Multiple images   (401 Views)
i have managed to pull images from my database and display them depending on a users selection from a drop-down list. however, within my database, i have four products with the same image (they have different product codes because they are different sizes but the images are the same) i have set a repeat region on the image in dreamweaver and if i open the webpage and select an option i am presnted with four identical images. so i deleted 3 of the image urls from the database but becuase of the repeat region, the ones i deleted still come up on my webpage as red crossses. how can i get rid of them
ASP image Thumbnails   (332 Views)
, I need to produce a page where the images are in thumbnails. Does anyone know an easy way to create thumbnails (without making a two copies of the image - one larger then the other lol) any suggestions would be ace but Code would be brilliant Each page may have a different number of image thumbnails so i was thinking about creating a repeating region on the image. Can anyone help
Binary image and upload form help   (403 Views)
. I have a form which upload a binary image and the description of that image into a Microsoft database. I want to show the user what he had uploaded in a second page using a resquest.querystring. But it doesn't show anything. I have tried to change to Request.form but there is an error: Error Type: Request object, ASP 0206 (0x80004005) Cannot call BinaryRead after using Request.Form collection What am i suppose to do i cannot put request.querystring cuz it doesn't show and i cannot use request.form cuz i am using binaryread.
Change image when hovered over   (318 Views)
How do you have an image change to another image when the mouse hovers over it
Shadow Uploader - preventing user from uploading non image files   (740 Views)
(regarding this thread: Originally Posted by Shadow Wizard this will not save non-image files. as for extension, I fear I didn't understand what you mean - you try to save the file with different extension I disagree. I was able to upload an Excel Spreadsheet with no trouble at all.
Do not cache image   (348 Views)
Hi all, In my asp code i generate a graph/plot which is saved as a .png file, so saved as an image to the server. The problem is when i revisit the page with different selections, a new image is generated but not shown in the HTML. The previous image is shown which is not deed. So i did some coding to not cache the image, but without succes. Here is some code i tried: Code: Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","no-cache,must-revalidate" Response.CacheControl = "no-cache" and Code: and i used "nosave" in the img tag Code: but all these options without succes. Anybody any ideas
random display of images   (436 Views)
, I am trying to retrieve images from the database and display them in a random order. The order of the images is supposed to change each time page is refreshed. Below is my code, I am using an array to store the images but the images are not displayed for some reason.
Upload image problems   (521 Views)
, I am trying to upload a picture to my server using the upload.asp component. when i try to upload the image i get the following error: Microsoft VBScript runtime (0x800A01C2) Wrong number of arguments or invalid property assignment: 'SaveToDisk' /alpha/admin/pages/saveCompletedProjects.asp, line 28 This is the code which uploads and saves the pictures to the server. aFilePath = "\images\compeletedProjects\" If Uploader.Files.Count > 0 Then for each aFile in Uploader.Files.Items aFileName = aFile.SaveToDisk (server.mappath("\alpha") & aFilePath) 'aFileName = aFilePath & aFileName next else aFileName = Uploader.Form("txtPreImage") end if can some body please help TrainerR
image resize   (453 Views)
please i need some help with this.. How can i resize a picture with asp, i mean i store the picture into the database, and when i display it, i just resize it from html, but it does not look good, not focused... basically how can you make a thumbnail.. Thank you
asp dynamic images   (419 Views)
hola first post, so go easy on me! i'm trying to create a function that will return an image of a specified width and height. rather than simply resizing an image and retaining its fat filesize, is there a way to create images on the fly from an original i know it is possible in php, but the server i am working on doesn't have it! cheers in advance vince
Resize the image and save problem   (474 Views)
I have problem with resizing a picture and don't know what the problem with the following code: dim fs dim sourcefile sourcefile = uploadsDirVar & filename set fs=Server.CreateObject("Scripting.FileSystemObject ") 'to access the data of the image dim iwidth, iHeight dim myImg if fs.fileExists(sourcefile) then set myImg = loadpicture(sourcefile) iwidth = round(myImg.width / 26.4583) iHeight = round(myImg.height / 26.4583) if (iwidth > 250) then iHeight = (iHeight * 250)/iwidth iwidth = 250 end if If (myImg.Width > iwidth) or (myImg.Height > iHeight) Then If (myImg.Width / iwidth) > (myImg.Height / iHeight) Then myImg.Resize iwidth, 0 Else myImg.Resize 0, iHeight End If End If myImg.WriteFile sourcefile set myImg = nothing end if set fs=nothing when i run it, the following error occur : Object doesn't support this property or method: 'myImg.Resize' Can anyone help me