Forum Moderators: open
currently im using this script to upload file, by jacob gilley. it works well in my localhost, but the script halt on SaveToDisk when i upload it on ftp, i try to response.write the path, the path is correct where i should save the file.
///////////////////////////////////////////////////////////////
the script
////////////////////////////////////////////////////////////
<%
response.Buffer = true
if session("userfullname") = "" then
response.Redirect("admin-login.asp")
end if
%>
<!-- #include file="admin_upload.asp" -->
<!-- #include file="connect.asp" -->
<!-- #include file="functions.asp" -->
'create file uploader
dim Uploader, tFile
set Uploader = New FileUploader
' This starts the upload process
Uploader.Upload()
if not isobject(Uploader.form("Upload Image")) then
If Uploader.Files.Count > 0 Then
set fs = server.CreateObject("Scripting.FileSystemObject")
if Uploader.form("fieldUpdate") = "enlarge" then
mpath = "photos/large/"&Uploader.Files("uploadfile").FileName
elseif Uploader.form("fieldUpdate") = "linedraw" then
mpath = "photos/line_drawing/"&Uploader.Files("uploadfile").FileName
elseif Uploader.form("fieldUpdate") = "normal" then
mpath = "photos/normal/"&Uploader.Files("uploadfile").FileName
end if
if Uploader.Files("uploadfile").FileName = session("imgName") and (fs.FileExists(server.MapPath(mpath))=true) then
errmsg = "ERROR : Invalid image name. Image already exist, please rename your filename."
else
if Uploader.form("fieldUpdate") = "enlarge" then
path = "photos\large\"
sql2 = "update "&session("category")&" set enlarge_img='"&Uploader.Files("uploadfile").FileName&"' where prod_code='"&session("pcodeUpdate")&"'"
elseif Uploader.form("fieldUpdate") = "linedraw" then
path = "photos\line_drawing\"
sql2 = "update "&session("category")&" set line_draw='"&Uploader.Files("uploadfile").FileName&"' where prod_code='"&session("pcodeUpdate")&"'"
elseif Uploader.form("fieldUpdate") = "normal" then
path = "photos\normal\"
sql2 = "update "&session("category")&" set img_path='"&Uploader.Files("uploadfile").FileName&"' where prod_code='"&session("pcodeUpdate")&"'"
end if
Uploader.Files("uploadfile").SaveToDisk server.MapPath(path) & "\" '"e:\inetpub\esvc000798\conserv2006\photos\line_drawing\"
'conn.execute sql2
errmsg = "File succesfully uploaded."
end if
End if
End if
<%
%> are incomplete for one thing, the includes are not at the top ,,
Anyway, you say it works on your local machine
Well that message suggests that your host hasn't given you permission to write to the folder in question, speak to them again an ask them about that
[asp101.com...]