Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ASP Simple Upload

Here I go again. Recently switched web hosts and was using Persits to upload files on our site. Now have to switch to ASP Simple Upload. Since I am a novice at this, I am getting errors. Can someone help me with where I am going wrong on the code.
Thanks,
Tracy McCarthy

Here it is -

<%
RegMemberID = Session("UserID")
Message = ""
Foldername = "f:/home/pisigma/pse.org/www/uploads/resumes"
fileurl = "http://www.pse.org/uploads/resumes"



'// UPLOAD RESUME...

if Request.ServerVariables("QUERY_STRING")="ul" then



Dim upl, NewFileName

Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
'Upload.SetMaxSize 50000, True '// reject files larger than 50KB
If Len(upl.Form("File1")) > 0 Then


'// create unique name, by including the member ID number
NewFileName = "resume" & CStr(RegMemberID) & "." & Right(File.Path,3)
'// if file already exists, delete it.
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile Foldername & NewFileName
Set fso = Nothing
'// Rename the resume
File.Move Foldername & NewFileName


sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
set rsJS = DbChapObj.Execute(sqlString)

if rsJS.EOF then
sqlString = "INSERT INTO JobSeeker (RegMemberID, ResumeFile, ResumeDate, Active) VALUES ("&RegMemberID&", '"&NewFileName&"', #"&now()&"#, "&false&");"
set rsJS = DbChapObj.Execute(sqlString)
else
sqlString = "UPDATE JobSeeker SET ResumeFile = '"&NewFileName&"', ResumeDate = #"&now()&"# WHERE RegMemberID = "&RegMemberID&";"
set rsJS = DbChapObj.Execute(sqlString)
end if

Message = "Your resume was successfully uploaded. If you haven't done so already, you should complete your resume profile (below)."

end if



ActionType = Request.Form("ActionType")



'// SAVE PROFILE...

if ActionType = "SAVE" then
LastPosition = StripQuotes(Request.Form("LastPosition"))
FieldOfInterest = StripQuotes(Request.Form("FieldOfInterest"))
Active = Request.Form("Active")

'// Check required fields...
if (LastPosition="") or (FieldOfInterest="") or (Active="") then
Message = "Your resume profile was not saved because one or more required fields were empty."
else

sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
set rsJS = DbChapObj.Execute(sqlString)

if rsJS.EOF then
Message = "You must upload a resume file before completing the Resume Profile section."
else
'// Update existing record
sqlString = "UPDATE JobSeeker SET LastPosition = '"&LastPosition&"', FieldOfInterest = '"&FieldOfInterest&"', Active = "&Active&" WHERE RegMemberID = "&RegMemberID&";"
set rsJS = DbChapObj.Execute(sqlString)
Message = "Your Resume Profile has been updated."
end if

end if



'// DELETE RESUME AND PROFILE...

elseif ActionType = "DELETE" then

sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
set rsJS = DbChapObj.Execute(sqlString)

'// if file already exists, delete it.
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(foldername & rsJS("ResumeFile")) then
fso.DeleteFile (foldername & rsJS("ResumeFile"))
end if
Set fso = Nothing

sqlString = "DELETE FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
set rsJS = DbChapObj.Execute(sqlString)
Message = "Your resume was removed."

end if
%>

Online Resume

<%=Message%>



<%
'// Load user info
sqlString = "SELECT * FROM RegisteredMembers WHERE (UserID = "& RegMemberID &");"
set rsRM = DbObj.Execute(sqlString)
if NOT rsRM.EOF then
FName = rsRM("FName")
Initial = rsRM("Initial")
LName = rsRM("LName")
Address1 = rsRM("Address1")
Address2 = rsRM("Address2")
City = rsRM("City")
StateX = rsRM("State")
Zip = rsRM("Zip")
Phone = rsRM("Phone")
Email =rsRM("Email")
end if

'// Load resume info
sqlString = "SELECT * FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
set rsJS = DbChapObj.Execute(sqlString)
ProfileExists = false '// init flag - does a resume already exist?

if rsJS.EOF then
'// no resume exists
ID = ""
ProfileExists = false
Active = false
ResumeOnFile = "NO"
else
ProfileExists = true
LastPosition = rsJS("LastPosition")
FieldOfInterest = rsJS("FieldOfInterest")
ResumeFile = rsJS("ResumeFile")
ResumeDate = rsJS("ResumeDate")
Active = rsJS("Active")
ResumeOnFile = "YES"
end if
%>

Upload Your Current Resume

Note: Our system keeps the most recent upload. You can determine how old our version of your resume is by the "Resume Date" listed in the next section below.

Resume:

First, use the "Browse" button below to locate your resume on your own computer.


 

Then, select "Upload Resume" to send your resume to us.


 




Complete Your Resume Profile

All fields must be filled out in order for your resume to be available to employers. If you have not yet uploaded your resume, do that first. You will not be able to save your profile unless you've uploaded a resume.


Name: <%=FName%> <%=Initial%> <%=LName%>
Address: <%=Address1%> <%=Address2%>
<%=City%>, <%=StateX%> <%=Zip%>
Phone: <%=Phone%>
Email: <%=Email%>
Resume On File: <%=ResumeOnFile%>
Resume Date: <%=ResumeDate%>
Current or Recent Position: ">
Field of Interest: ">
Make Available to Employers: Note: If you want employers to see your resume, select "Yes". If you select "No", we'll keep your resume on file but it will not be shared with employers. You can always activate it by returning to this screen and selecting "Yes".

>Yes   
>No
 


">


<% if ProfileExists then %>

<% else %>

<% end if %>





<%
if ProfileExists then
%>




Delete Your Resume and Resume Profile


By selecting "Delete", you'll completely remove your resume/profile from our system. If you want to temporarily hide it from employers, select "No" in the "Make Available to Employers" box above. If you do delete your resume/profile, you can always create a new one.


">


<%
end if
%>

Comments

  • FlakesFlakes Member Posts: 642
    copy paste the error message here.
  • keltrakeltra Member Posts: 7
    : copy paste the error message here.
    :
    The error below shows up when I go to the URL. http://www.pse.org/pseonline-career-profile2.asp I have the page on our host server already. Line 278 is at the very end of the code the last "end if" statement. Thanks for your help.

    Microsoft VBScript compilation error '800a03f6'

    Expected 'End'

    /pseonline-career-profile2.asp, line 278


    Tracy
  • FlakesFlakes Member Posts: 642
    [b][red]This message was edited by Flakes at 2005-8-11 21:30:9[/red][/b][hr]
    Try indenting your code , so that you can find the missing ifs easily..

    [code]
    <%
    RegMemberID = Session("UserID")
    Message = ""
    Foldername = "f:/home/pisigma/pse.org/www/uploads/resumes"
    fileurl = "http://www.pse.org/uploads/resumes"



    '// UPLOAD RESUME...

    if Request.ServerVariables("QUERY_STRING")="ul" then



    Dim upl, NewFileName

    Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
    'Upload.SetMaxSize 50000, True '// reject files larger than 50KB
    If Len(upl.Form("File1")) > 0 Then


    '// create unique name, by including the member ID number
    NewFileName = "resume" & CStr(RegMemberID) & "." & Right(File.Path,3)
    '// if file already exists, delete it.
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile Foldername & NewFileName
    Set fso = Nothing
    '// Rename the resume
    File.Move Foldername & NewFileName


    sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    set rsJS = DbChapObj.Execute(sqlString)

    if rsJS.EOF then
    sqlString = "INSERT INTO JobSeeker (RegMemberID, ResumeFile, ResumeDate, Active) VALUES ("&RegMemberID&", '"&NewFileName&"', #"&now()&"#, "&false&");"
    set rsJS = DbChapObj.Execute(sqlString)
    else
    sqlString = "UPDATE JobSeeker SET ResumeFile = '"&NewFileName&"', ResumeDate = #"&now()&"# WHERE RegMemberID = "&RegMemberID&";"
    set rsJS = DbChapObj.Execute(sqlString)
    end if

    Message = "Your resume was successfully uploaded. If you haven't done so already, you should complete your resume profile (below)."

    end if


    End If '[red]I added this one[/red]
    ActionType = Request.Form("ActionType")



    '// SAVE PROFILE...

    if ActionType = "SAVE" then
    LastPosition = StripQuotes(Request.Form("LastPosition"))
    FieldOfInterest = StripQuotes(Request.Form("FieldOfInterest"))
    Active = Request.Form("Active")

    '// Check required fields...
    if (LastPosition="") or (FieldOfInterest="") or (Active="") then
    Message = "Your resume profile was not saved because one or more required fields were empty."
    else

    sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    set rsJS = DbChapObj.Execute(sqlString)

    if rsJS.EOF then
    Message = "You must upload a resume file before completing the Resume Profile section."
    else
    '// Update existing record
    sqlString = "UPDATE JobSeeker SET LastPosition = '"&LastPosition&"', FieldOfInterest = '"&FieldOfInterest&"', Active = "&Active&" WHERE RegMemberID = "&RegMemberID&";"
    set rsJS = DbChapObj.Execute(sqlString)
    Message = "Your Resume Profile has been updated."
    end if

    end if



    '// DELETE RESUME AND PROFILE...

    elseif ActionType = "DELETE" then

    sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    set rsJS = DbChapObj.Execute(sqlString)

    '// if file already exists, delete it.
    Set fso = CreateObject("Scripting.FileSystemObject")
    if fso.FileExists(foldername & rsJS("ResumeFile")) then
    fso.DeleteFile (foldername & rsJS("ResumeFile"))
    end if
    Set fso = Nothing

    sqlString = "DELETE FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
    set rsJS = DbChapObj.Execute(sqlString)
    Message = "Your resume was removed."

    end if
    %>

    Online Resume

    <%=Message%>



    <%
    '// Load user info

    sqlString = "SELECT * FROM RegisteredMembers WHERE (UserID = "& RegMemberID &");"
    set rsRM = DbObj.Execute(sqlString)
    if NOT rsRM.EOF then
    FName = rsRM("FName")
    Initial = rsRM("Initial")
    LName = rsRM("LName")
    Address1 = rsRM("Address1")
    Address2 = rsRM("Address2")
    City = rsRM("City")
    StateX = rsRM("State")
    Zip = rsRM("Zip")
    Phone = rsRM("Phone")
    Email =rsRM("Email")
    end if

    '// Load resume info
    sqlString = "SELECT * FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
    set rsJS = DbChapObj.Execute(sqlString)
    ProfileExists = false '// init flag - does a resume already exist?

    if rsJS.EOF then
    '// no resume exists
    ID = ""
    ProfileExists = false
    Active = false
    ResumeOnFile = "NO"
    else
    ProfileExists = true
    LastPosition = rsJS("LastPosition")
    FieldOfInterest = rsJS("FieldOfInterest")
    ResumeFile = rsJS("ResumeFile")
    ResumeDate = rsJS("ResumeDate")
    Active = rsJS("Active")
    ResumeOnFile = "YES"
    end if
    %>

    Upload Your Current Resume

    Note: Our system keeps the most recent upload. You can determine how old our version of your resume is by the "Resume Date" listed in the next section below.

    Resume:

    First, use the "Browse" button below to locate your resume on your own computer.

     
    Then, select "Upload Resume" to send your resume to us.


     



    Complete Your Resume Profile

    All fields must be filled out in order for your resume to be available to employers. If you have not yet uploaded your resume, do that first. You will not be able to save your profile unless you've uploaded a resume.

    Name: <%=FName%> <%=Initial%> <%=LName%>
    Address: <%=Address1%> <%=Address2%><%=City%>, <%=StateX%> <%=Zip%>
    Phone: <%=Phone%>
    Email: <%=Email%>
    Resume On File: <%=ResumeOnFile%>
    Resume Date: <%=ResumeDate%>
    Current or Recent Position: ">
    Field of Interest: ">
    Make Available to Employers: Note: If you want employers to see your resume, select "Yes". If you select "No", we'll keep your resume on file but it will not be shared with employers. You can always activate it by returning to this screen and selecting "Yes".
    >Yes   
    >No
     

    ">


    <% if ProfileExists then %>

    <% else %>

    <% end if %>





    <%
    if ProfileExists then
    %>



    Delete Your Resume and Resume Profile


    By selecting "Delete", you'll completely remove your resume/profile from our system. If you want to temporarily hide it from employers, select "No" in the "Make Available to Employers" box above. If you do delete your resume/profile, you can always create a new one.


    ">


    <%
    end if
    %>
    [/code]

    Let us know how it goes.


  • keltrakeltra Member Posts: 7
    Ok-Thanks Flakes that solved that error. Now I am getting a new one. I know I am missing something somewhere but for the life of me I can't figure it out. Here is the error -

    Microsoft VBScript runtime error '800a01a8'

    Object required: 'File'

    /pseonline-career-profile.asp, line 30

    It refers to this line of code when I try to upload a file.

    '// create unique name, by including the member ID number
    NewFileName = "resume" & CStr(RegMemberID) & "." & Right(File.Path,3)


    : [b][red]This message was edited by Flakes at 2005-8-11 21:30:9[/red][/b][hr]
    : Try indenting your code , so that you can find the missing ifs easily..
    :
    : [code]
    : <%
    : RegMemberID = Session("UserID")
    : Message = ""
    : Foldername = "f:/home/pisigma/pse.org/www/uploads/resumes"
    : fileurl = "http://www.pse.org/uploads/resumes"
    :
    :
    :
    : '// UPLOAD RESUME...
    :
    : if Request.ServerVariables("QUERY_STRING")="ul" then
    :
    :
    :
    : Dim upl, NewFileName
    :
    : Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
    : 'Upload.SetMaxSize 50000, True '// reject files larger than 50KB
    : If Len(upl.Form("File1")) > 0 Then
    :
    :
    : '// create unique name, by including the member ID number
    : NewFileName = "resume" & CStr(RegMemberID) & "." & Right(File.Path,3)
    : '// if file already exists, delete it.
    : Set fso = CreateObject("Scripting.FileSystemObject")
    : fso.DeleteFile Foldername & NewFileName
    : Set fso = Nothing
    : '// Rename the resume
    : File.Move Foldername & NewFileName
    :
    :
    : sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    : set rsJS = DbChapObj.Execute(sqlString)
    :
    : if rsJS.EOF then
    : sqlString = "INSERT INTO JobSeeker (RegMemberID, ResumeFile, ResumeDate, Active) VALUES ("&RegMemberID&", '"&NewFileName&"', #"&now()&"#, "&false&");"
    : set rsJS = DbChapObj.Execute(sqlString)
    : else
    : sqlString = "UPDATE JobSeeker SET ResumeFile = '"&NewFileName&"', ResumeDate = #"&now()&"# WHERE RegMemberID = "&RegMemberID&";"
    : set rsJS = DbChapObj.Execute(sqlString)
    : end if
    :
    : Message = "Your resume was successfully uploaded. If you haven't done so already, you should complete your resume profile (below)."
    :
    : end if
    :
    :
    : End If '[red]I added this one[/red]
    : ActionType = Request.Form("ActionType")
    :
    :
    :
    : '// SAVE PROFILE...
    :
    : if ActionType = "SAVE" then
    : LastPosition = StripQuotes(Request.Form("LastPosition"))
    : FieldOfInterest = StripQuotes(Request.Form("FieldOfInterest"))
    : Active = Request.Form("Active")
    :
    : '// Check required fields...
    : if (LastPosition="") or (FieldOfInterest="") or (Active="") then
    : Message = "Your resume profile was not saved because one or more required fields were empty."
    : else
    :
    : sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    : set rsJS = DbChapObj.Execute(sqlString)
    :
    : if rsJS.EOF then
    : Message = "You must upload a resume file before completing the Resume Profile section."
    : else
    : '// Update existing record
    : sqlString = "UPDATE JobSeeker SET LastPosition = '"&LastPosition&"', FieldOfInterest = '"&FieldOfInterest&"', Active = "&Active&" WHERE RegMemberID = "&RegMemberID&";"
    : set rsJS = DbChapObj.Execute(sqlString)
    : Message = "Your Resume Profile has been updated."
    : end if
    :
    : end if
    :
    :
    :
    : '// DELETE RESUME AND PROFILE...
    :
    : elseif ActionType = "DELETE" then
    :
    : sqlString = "SELECT * FROM JobSeeker WHERE RegMemberID = "&RegMemberID&";"
    : set rsJS = DbChapObj.Execute(sqlString)
    :
    : '// if file already exists, delete it.
    : Set fso = CreateObject("Scripting.FileSystemObject")
    : if fso.FileExists(foldername & rsJS("ResumeFile")) then
    : fso.DeleteFile (foldername & rsJS("ResumeFile"))
    : end if
    : Set fso = Nothing
    :
    : sqlString = "DELETE FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
    : set rsJS = DbChapObj.Execute(sqlString)
    : Message = "Your resume was removed."
    :
    : end if
    : %>
    :
    :

    Online Resume

    :
    :
    :
    :

    <%=Message%>

    :
    :
    :
    : <%
    : '// Load user info
    :
    : sqlString = "SELECT * FROM RegisteredMembers WHERE (UserID = "& RegMemberID &");"
    : set rsRM = DbObj.Execute(sqlString)
    : if NOT rsRM.EOF then
    : FName = rsRM("FName")
    : Initial = rsRM("Initial")
    : LName = rsRM("LName")
    : Address1 = rsRM("Address1")
    : Address2 = rsRM("Address2")
    : City = rsRM("City")
    : StateX = rsRM("State")
    : Zip = rsRM("Zip")
    : Phone = rsRM("Phone")
    : Email =rsRM("Email")
    : end if
    :
    : '// Load resume info
    : sqlString = "SELECT * FROM JobSeeker WHERE (RegMemberID = "& RegMemberID &");"
    : set rsJS = DbChapObj.Execute(sqlString)
    : ProfileExists = false '// init flag - does a resume already exist?
    :
    : if rsJS.EOF then
    : '// no resume exists
    : ID = ""
    : ProfileExists = false
    : Active = false
    : ResumeOnFile = "NO"
    : else
    : ProfileExists = true
    : LastPosition = rsJS("LastPosition")
    : FieldOfInterest = rsJS("FieldOfInterest")
    : ResumeFile = rsJS("ResumeFile")
    : ResumeDate = rsJS("ResumeDate")
    : Active = rsJS("Active")
    : ResumeOnFile = "YES"
    : end if
    : %>
    :

    :

    Upload Your Current Resume

    :

    Note: Our system keeps the most recent upload. You can determine how old our version of your resume is by the "Resume Date" listed in the next section below.

    :
    : : :
    Resume:
    :
    : First, use the "Browse" button below to locate your resume on your own computer.
    :

     
    : Then, select "Upload Resume" to send your resume to us.
    :


    :

    :  
    :

    :
    :
    :
    :

    Complete Your Resume Profile

    :

    All fields must be filled out in order for your resume to be available to employers. If you have not yet uploaded your resume, do that first. You will not be able to save your profile unless you've uploaded a resume.

    :
    :
    :
    : : : : : : : : :
    : : : : : : : : : : :
    :
    Name:<%=FName%> <%=Initial%> <%=LName%>
    Address:<%=Address1%> <%=Address2%><%=City%>, <%=StateX%> <%=Zip%>
    Phone:<%=Phone%>
    Email:<%=Email%>
    Resume On File:<%=ResumeOnFile%>
    Resume Date:<%=ResumeDate%>
    Current or Recent Position:">
    Field of Interest:">
    Make Available to Employers:Note: If you want employers to see your resume, select "Yes". If you select "No", we'll keep your resume on file but it will not be shared with employers. You can always activate it by returning to this screen and selecting "Yes".
    : >Yes   
    : >No
    :  
    :
    : ">
    :
    :
    : <% if ProfileExists then %>
    :
    : <% else %>
    :
    : <% end if %>
    :
    :
    :
    :
    :
    : <%
    : if ProfileExists then
    : %>
    :
    :
    :

    :

    Delete Your Resume and Resume Profile

    :
    : :

    : By selecting "Delete", you'll completely remove your resume/profile from our system. If you want to temporarily hide it from employers, select "No" in the "Make Available to Employers" box above. If you do delete your resume/profile, you can always create a new one.
    :


    : ">
    :
    :
    :

    : <%
    : end if
    : %>
    : [/code]
    :
    : Let us know how it goes.
    :
    :
    :
  • FlakesFlakes Member Posts: 642
    [b][red]This message was edited by Flakes at 2005-8-13 6:8:35[/red][/b][hr]
    ..
  • FlakesFlakes Member Posts: 642


    [code]
    NewFileName = "resume" & CStr(RegMemberID) & "." & Right(upl.Form("File1").Path,3)
    [/code]


  • keltrakeltra Member Posts: 7
    This is beginning to seriously frustrate me. I made that change and now get this error. (Same line of code) It seems not to be recognizing that I have a file that I want to upload.

    Microsoft VBScript runtime error '800a01a8'

    Object required: 'Form(...)'

    /pseonline-career-profile.asp, line 30

    Thanks,
    Tracy
  • FlakesFlakes Member Posts: 642

    I dont know whats happening,but what happens if you do this :



    [code]
    NewFileName = "resume" & CStr(RegMemberID) & "." & Right(upl.ExtractFileName(upl.Form("File1")) ,3)
    [/code]

  • keltrakeltra Member Posts: 7
    Will my horror ever end. New error has arrived.

    Microsoft VBScript runtime error '800a0035'

    File not found

    /pseonline-career-profile.asp, line 33

    Which refers to this code -

    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile Foldername & NewFileName
    Set fso = Nothing
    '// Rename the resume
    File.Move Foldername & NewFileName

    Thanks for all your help.

    Tracy
  • FlakesFlakes Member Posts: 642
    : Will my horror ever end. New error has arrived.
    :
    : Microsoft VBScript runtime error '800a0035'
    :
    : File not found
    :
    : /pseonline-career-profile.asp, line 33
    :
    : Which refers to this code -
    :
    : Set fso = CreateObject("Scripting.FileSystemObject")
    : fso.DeleteFile Foldername & NewFileName
    : Set fso = Nothing
    : '// Rename the resume
    : File.Move Foldername & NewFileName
    :
    : Thanks for all your help.
    :
    : Tracy
    :

    Please tracy, do some debugging :-)

    To start with, find which file it is looking for ..

    response.Write "File Name Is :"&Foldername & NewFileName
    response.end

    Add this code BEFORE the line where the error occurs.


    And, that code, deletes a file and then tries to move the same file?How can that be possible? Think about it .


Sign In or Register to comment.