Tuesday 21 August 2012

file upload file name change


// lblrow is the guid function value

   string _databasepath = null;
        if (FileUpload1.HasFile)
        {
            string _Fname = FileUpload1.FileName.ToString();
            _Fname = lblrow_id.Text.Trim()+ "" + Path.GetExtension(FileUpload1.PostedFile.FileName);
           string _Path = "~/user/profilePic/" + _Fname;
             _databasepath = "profilePic/" + _Fname;
            string targetPath = Server.MapPath(_Path);
           // FileUpload1.SaveAs(_Path);

            Stream strm = FileUpload1.PostedFile.InputStream;
            var targetFile = targetPath;
           
            //Based on scalefactor image size will vary
           GenerateThumbnails(0.5, strm, targetFile);

        }
        par[8] = appReg.addPara("@profilePic", SqlDbType.VarChar, _databasepath);

No comments:

Post a Comment