Avatar billede guzzie Nybegynder
09. maj 2001 - 11:36 Der er 3 kommentarer og
1 løsning

Upload Script Damn Strange

hey there

I use a upload script and it has always worked fine how now I have added a little extra to it so it checks if the file being uploaded is jpg or gif

here it is
<%

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

Upload.OverwriteFiles = True
Upload.SetMaxSize 1048576

Count = Upload.Save(\"D:\\home\\guzziedk\\www\\upload\\tmp\\\")
    uploadpath = upload.form(\"uploadpath\")
For Each File in Upload.Files
    File.Copy uploadpath & File.ExtractFileName
    File.Delete
next


For Each File in Upload.Files

If File.ImageType <> \"gif\" and File.ImageType <> \"jpg\" Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")

End If
If File.ImageWidth > 800 Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")

End If

If File.ImageHeight > 600 Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")

End If


pic = File.ExtractFileName

Next
%>

the problem is that it redirects everytime it checks the File.ImageType
And the file are gif and jpg that im uploading ??

Any ideas
Guzzie
Avatar billede guzzie Nybegynder
09. maj 2001 - 11:39 #1
Oops! like this i mean
For Each File in Upload.Files

If File.ImageType <> \"gif\" and File.ImageType <> \"jpg\" Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")
  Exit For
End If
If File.ImageWidth > 800 Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")
  Exit For
End If

If File.ImageHeight > 600 Then
  Response.redirect (\"upload_upload_pic_news.asp?id=\" & Id & \"&error=0\")
  Exit For
End If


pic = File.ExtractFileName

Next
%>

Avatar billede guzzie Nybegynder
09. maj 2001 - 12:41 #2
hmm fixed it so I will close the question now
Avatar billede burningice Nybegynder
09. maj 2001 - 19:57 #3
how did u solve the problem??
Avatar billede guzzie Nybegynder
09. maj 2001 - 21:38 #4
hey cyber

I stopped using a tempoary map path that got called and intead had the map path in the upload script

I dont know why it would not work before but it does now ( except that i dont choose the map path myself )

so I lost a little and gained a little

Guzzie
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester