Need multiple File Upload - Checkout Attribute

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I have been looking around the net and in the forums and I cannot find any implementation on a multiple file upload as a checkout attributes.

Most of our products need a logo or other graphic and having a multiple file upload checkout attribute would be a great addition.

Currently I have three file uploads, but it looks a little clumsy and if they need more than three...

Anyone with samples or a full implementation out there?

I'd appreciate it very much.
6 years ago
chris.navarro7 wrote:
I have been looking around the net and in the forums and I cannot find any implementation on a multiple file upload as a checkout attributes.

Most of our products need a logo or other graphic and having a multiple file upload checkout attribute would be a great addition.

Currently I have three file uploads, but it looks a little clumsy and if they need more than three...

Anyone with samples or a full implementation out there?

I'd appreciate it very much.


Go through ==>
Nop.Web\Administration\Controllers\RoxyFilemanController.cs


  public virtual void ProcessRequest() {
            string action = "DIRLIST";

            //custom code by nopCommerce team
            if (!_permissionService.Authorize(StandardPermissionProvider.HtmlEditorManagePictures))
                _r.Write(GetErrorRes("You don't have required permission"));

            try{
                if (_context.Request["a"] != null)
                    action = (string)_context.Request["a"];

                //custom code by nopCommerce team
                //VerifyAction(action);
                switch (action.ToUpper())
                {
                   //  has more code
                  
                    case "UPLOAD":
                        Upload(_context.Request["d"]);

                  // has more code
                  
                }
        
            }
            catch(Exception ex){
                if (action == "UPLOAD" && !IsAjaxUpload())
                {
                    _r.Write("<script>");
                    _r.Write("parent.fileUploaded(" + GetErrorRes(LangRes("E_UploadNoFiles")) + ");");
                    _r.Write("</script>");
                }
                else{
                    _r.Write(GetErrorRes(ex.Message));
                }
            }
        
        }



  protected virtual void Upload(string path)
        {
            CheckPath(path);
            path = FixPath(path);
            string res = GetSuccessRes();
            bool hasErrors = false;
            try{
                for(int i = 0; i < Request.Files.Count; i++){
                    if (CanHandleFile(Request.Files[i].FileName))
                    {
                        FileInfo f = new FileInfo(Request.Files[i].FileName);
                        string filename = MakeUniqueFilename(path, f.Name);
                        string dest = Path.Combine(path, filename);
                        Request.Files[i].SaveAs(dest);
                        if (GetFileType(new FileInfo(filename).Extension) == "image")
                        {
                            int w = 0;
                            int h = 0;
                            int.TryParse(GetSetting("MAX_IMAGE_WIDTH"), out w);
                            int.TryParse(GetSetting("MAX_IMAGE_HEIGHT"), out h);
                            ImageResize(dest, dest, w, h);
                        }
                    }
                    else
                    {
                        hasErrors = true;
                        res = GetSuccessRes(LangRes("E_UploadNotAll"));
                    }
                }
            }
            catch(Exception ex){
                res = GetErrorRes(ex.Message);
            }
            if (IsAjaxUpload())
            {
                if(hasErrors)
                    res = GetErrorRes(LangRes("E_UploadNotAll"));
                _r.Write(res);
            }
            else
            {
                _r.Write("<script>");
                _r.Write("parent.fileUploaded(" + res + ");");
                _r.Write("</script>");
            }
        }
        


Hope these clue will help you.
6 years ago
Thanks Sohel, I'll give it a try!
6 years ago
Sohel,

This code is for the Admin, I am looking for code for a multiple file upload as a checkout attribute.  Did you give me this code as a sample of what can be done or were you thinking this was for the Admin site, for multiple uploads?

Is he file upload checkout attribute also a Roxy File manager object?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.