public FineUploaderResult UploadPdf(FineUpload upload)
        {
            try
            {
                string fileName = null;
                string filedir = Request.QueryString["action"];
                if (string.IsNullOrEmpty(filedir))
                {
                    filedir = "DefaultFile";
                }

                string tempDir = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string dir = Path.Combine(Request.PhysicalApplicationPath, "Upload", filedir, tempDir);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                fileName = Path.GetFileName(upload.Filename);
                upload.SaveAs(Path.Combine(dir, fileName));
                var absPath = "/Upload/" + filedir + "/" + tempDir + "/" + fileName;
                SwftoolsHelp.PDF2Swf(absPath, absPath + ".swf");

                return new FineUploaderResult(true, new { success = "true", filePath = absPath, fileName = fileName });
            }
            catch (Exception ex)
            {
                return new FineUploaderResult(false, error: ex.Message);
            }
        }
        public FineUploaderResult UploadFile(FineUpload upload)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader
            try
            {
                string fileName = null;
                string filedir = Request.QueryString["action"];
                if (string.IsNullOrEmpty(filedir))
                {
                    filedir = "DefaultFile";
                }

                string tempDir = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string dir = Path.Combine(Request.PhysicalApplicationPath, "Upload", filedir, tempDir);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                fileName = Path.GetFileName(upload.Filename);
                upload.SaveAs(Path.Combine(dir, fileName));

                return new FineUploaderResult(true, new { success = "true", filePath = "/Upload/" + filedir + "/" + tempDir + "/" + fileName, fileName = fileName });
            }
            catch (Exception ex)
            {
                return new FineUploaderResult(false, error: ex.Message);
            }
        }
        public FineUploaderResult UploadPdf(FineUpload upload)
        {
            try
            {
                string fileName = null;
                string filedir  = Request.QueryString["action"];
                if (string.IsNullOrEmpty(filedir))
                {
                    filedir = "DefaultFile";
                }

                string tempDir = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string dir     = Path.Combine(Request.PhysicalApplicationPath, "Upload", filedir, tempDir);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                fileName = Path.GetFileName(upload.Filename);
                upload.SaveAs(Path.Combine(dir, fileName));
                var absPath = "/Upload/" + filedir + "/" + tempDir + "/" + fileName;
                SwftoolsHelp.PDF2Swf(absPath, absPath + ".swf");

                return(new FineUploaderResult(true, new { success = "true", filePath = absPath, fileName = fileName }));
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }
        }
        public FineUploaderResult UploadFile(FineUpload upload)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader
            try
            {
                string fileName = null;
                string filedir  = Request.QueryString["action"];
                if (string.IsNullOrEmpty(filedir))
                {
                    filedir = "DefaultFile";
                }

                string tempDir = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string dir     = Path.Combine(Request.PhysicalApplicationPath, "Upload", filedir, tempDir);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                fileName = Path.GetFileName(upload.Filename);
                upload.SaveAs(Path.Combine(dir, fileName));

                return(new FineUploaderResult(true, new { success = "true", filePath = "/Upload/" + filedir + "/" + tempDir + "/" + fileName, fileName = fileName }));
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }
        }
        public FineUploaderResult UploadFile(FineUpload upload, string extraParam1, int extraParam2)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader

            var dir = @"c:\upload\path";
            var filePath = Path.Combine(dir, upload.Filename);
            try
            {
                upload.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                return new FineUploaderResult(false, error: ex.Message);
            }

            // the anonymous object in the result below will be convert to json and set back to the browser
            return new FineUploaderResult(true, new { extraInformation = 12345 });
        }
Пример #6
0
        public FineUploaderResult UploadFile(FineUpload upload, string extraParam1, int extraParam2)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader

            var dir      = @"c:\upload\path";
            var filePath = Path.Combine(dir, upload.Filename);

            try
            {
                upload.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }

            // the anonymous object in the result below will be convert to json and set back to the browser
            return(new FineUploaderResult(true, new { extraInformation = 12345 }));
        }
Пример #7
0
        public FineUploaderResult UploadFile(FineUpload upload, string extraParam1 = null, int extraParam2 = 0)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader

            var dir = Server.MapPath(Constant.UPLOADED_FILES_DIRECTORY);

            var filePath = Path.Combine(dir, upload.Filename);

            try
            {
                upload.SaveAs(filePath);


                return(new FineUploaderResult(true, new { FilePath = filePath }));
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }

            // the anonymous object in the result below will be convert to json and set back to the browser
            //return new FineUploaderResult(true, new { extraInformation = 12345 });
        }