<%@ LANGUAGE="JSCRIPT" %><% // // Receive a plan upload (typ. from Planner) // // 04-Nov-07 rbd Initial edit // if(!User.CanUpload && !User.IsAdministrator) { Response.Write("No permission to upload"); Response.End(); } if(Request.ServerVariables("request_method").toLowerCase() != "post") { Response.Write("This URL allows only uploaded content"); Response.End(); } // // Move the file from it's temporary location to its final location. // if(Request.Form("FileName")) // Did upload the file { var fso = new ActiveXObject("Scripting.FileSystemObject"); var dest = Server.MapPath("\\plans\\" + User.Username) + "\\" + fso.GetFileName(Request.Form("FilePath")); if(dest.toLowerCase() != Request.Form("FilePath").toLowerCase()) { try { fso.CopyFile(Request.Form("FilePath"), dest, true); // Replace fso.DeleteFile(Request.Form("FilePath")); Response.Write("Plan uploaded successfully"); } catch(ex) { Response.Write("Upload failed: " + (ex.message ? ex.message : ex)); } } else { Response.Write("Plan uploaded successfully."); } } else { Response.Write("No file in upload request"); } %>