예제 #1
0
        /// <summary>
        /// Return a url that can be embedded in the action attribute of a form element
        /// </summary>
        /// <param name="redirectUrl">The url to redirect to after the upload is complete</param>
        /// <param name="permissionDomain">The permission domain in which the upload should be placed</param>
        public String GetUploadUrl(String redirectUrl, String permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain))
            {
                request.Parameters.Add("pd", permissionDomain);
            }
            if (!String.IsNullOrEmpty(redirectUrl))
            {
                request.Parameters.Add("redirecturl", redirectUrl);
            }
            return(request.ConstructUrl("rustici.upload.uploadFile"));
        }
        /// <summary>
        /// Upload a file to your Scorm Cloud upload space
        /// </summary>
        /// <param name="absoluteFilePathToZip">Absolute local path to file to be uploaded</param>
        /// <param name="permissionDomain">The upload "permission domain" under which to upload the file</param>
        /// <param name="token">A previously acquired upload token to be used for this upload request</param>
        /// <returns>A relative path to the file uploaded, which should be used in a subsequent call to ImportCourse or VersionCourse</returns>
        public UploadResult UploadFile(string absoluteFilePathToZip, string permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.FileToPost = absoluteFilePathToZip;

            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain)) {
                request.Parameters.Add("pd", permissionDomain);
            }

            XmlDocument response = request.CallService("rustici.upload.uploadFile");
            XmlElement location = (XmlElement)response.GetElementsByTagName("location")[0];
            
            UploadResult result = new UploadResult();
            result.server = token.server;
            result.location = location.InnerText;
            return result;
        }
        /// <summary>
        /// Return a url that can be embedded in the action attribute of a form element
        /// </summary>
        /// <param name="redirectUrl">The url to redirect to after the upload is complete</param>
        /// <param name="permissionDomain">The permission domain in which the upload should be placed</param>
        public String GetUploadUrl(String redirectUrl, String permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain)) {
                request.Parameters.Add("pd", permissionDomain);
            }
            if (!String.IsNullOrEmpty(redirectUrl)) {
                request.Parameters.Add("redirecturl", redirectUrl);
            }
            return request.ConstructUrl("rustici.upload.uploadFile");
        }
예제 #4
0
        /// <summary>
        /// Upload a file to your Scorm Cloud upload space
        /// </summary>
        /// <param name="absoluteFilePathToZip">Absolute local path to file to be uploaded</param>
        /// <param name="permissionDomain">The upload "permission domain" under which to upload the file</param>
        /// <param name="token">A previously acquired upload token to be used for this upload request</param>
        /// <returns>A relative path to the file uploaded, which should be used in a subsequent call to ImportCourse or VersionCourse</returns>
        public UploadResult UploadFile(string absoluteFilePathToZip, string permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.FileToPost = absoluteFilePathToZip;

            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain))
            {
                request.Parameters.Add("pd", permissionDomain);
            }

            XmlDocument response = request.CallService("rustici.upload.uploadFile");
            XmlElement  location = (XmlElement)response.GetElementsByTagName("location")[0];

            UploadResult result = new UploadResult();

            result.server   = token.server;
            result.location = location.InnerText;
            return(result);
        }
예제 #5
0
        /// <summary>
        /// Upload a file to your Scorm Cloud upload space
        /// </summary>
        /// <param name="absoluteFilePathToZip">Absolute local path to file to be uploaded</param>
        /// <param name="permissionDomain">The upload "permission domain" under which to upload the file</param>
        /// <returns>A relative path to the file uploaded, which should be used in a subsequent call to ImportCourse or VersionCourse</returns>
        public UploadResult UploadFile(string absoluteFilePathToZip, string permissionDomain)
        {
            UploadToken token = GetUploadToken();

            return(UploadFile(absoluteFilePathToZip, permissionDomain, token));
        }