...

View Full Version : asp upload error



skalag
02-08-2007, 09:58 PM
hi im using persits asp upload butr i have run into an error. I add data to database and upload images, but i have used basicaslly the same form for edit of that data and the same basic code to update the data as i use to add it. Adding gives no problem but updating gives this error. ive tried chopping and changing but i cant get by this.

error is:
-----------------------------------------------
Microsoft VBScript runtime error '800a01a8'

Object required: 'Upload.Files(...)'

-------------------------------------------------


To add files i have first asp page:



<form action="diaryaddprocess.asp" method="post" enctype="multipart/form-data" name="frmadd">
<input name="file1" type="file" size="35" />
<input name="txtDate" type="hidden" value="<%=TodayDate%>" />
</form>


And second asp page



Set Upload = Server.CreateObject("Persits.Upload.1")

Upload.OverwriteFiles = False
Upload.SetMaxSize 1048576 ' Limit files to 1MB
Count = Upload.SaveVirtual("/imagesupload/")

StrPic1 = Upload.Files("file1").filename
DatDate = Upload.Form("txtDate")


I use exactly the same for editing and updating the data but i get the above error. I cant see anything else wrong. obviously i have removed a lot of code from above example but i have also removed everything from the update process page except for this



Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.OverwriteFiles = False
Count = Upload.SaveVirtual("/imagesupload/")

StrPic1 = Upload.Files("file1").filename
response.write StrPic1


i then get this error

---------------------------------------
Microsoft VBScript runtime error '800a01a8'

Object required: '[object]'
-------------------------------------------

im trying to figure out the change in error but im stuck, almost forgot the important bit - the images are being uploaded to the folder but i cant get the rest of the data. problem seems to be on this line :

StrPic1 = Upload.Files("file1").filename

skalag
02-08-2007, 11:34 PM
Well after 48 hours of failure i finally posted here in desperation but now i have solved it, hopefully permanently - i had a couple false dawns! Well simple solution was i should have checked to see if a new image was being uploaded or if the file field was left blank. When it was blank it seemed to crash, but for a while it also crashed when i filled all 3 file fields used. thing is i have done this exactly the same as above on 3 other pages and they dont crash when the field is blank.



Set File = Upload.Files("file1")
If Not File Is Nothing Then
StrPic1 = Upload.Files("file1").filename
End If


Set File = Upload.Files("file2")
If Not File Is Nothing Then
StrPic2 = Upload.Files("file2").filename
End If



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum