This is a migrated thread and some comments may be shown as answers.

Upload doesn't work??

1 Answer 81 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vjeran
Top achievements
Rank 2
Vjeran asked on 07 Oct 2008, 09:07 PM
Question: Why image upload doesn't work? I press it and nothing happens?

aspx

<telerik:RadEditor ID="RadEditor1" runat="server" Skin="Telerik" OnDataBinding="BindTextEditor">
                        <Tools>
                            <telerik:EditorToolGroup Tag="FileManagers">
                                <telerik:EditorTool Name="ImageManager" />
                                <telerik:EditorTool Name="FlashManager" />
                                <telerik:EditorTool Name="MediaManager" />
                                <telerik:EditorTool Name="DocumentManager" />
                                <telerik:EditorTool Name="TemplateManager" />
                            </telerik:EditorToolGroup>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                                <telerik:EditorSeparator />
                                <telerik:EditorTool Name="ForeColor" />
                                <telerik:EditorTool Name="BackColor" />
                                <telerik:EditorSeparator />
                                <telerik:EditorTool Name="FontName" />
                                <telerik:EditorTool Name="RealFontSize" />
                            </telerik:EditorToolGroup>
                        </Tools>
                    </telerik:RadEditor>

c#
this is called when i do
if (!IsPostBack)
            {
                GeneratePath();
            }

private void GeneratePath()
        {
            string GenericRootFolder = "~/Repository";
            string TempStoreFolder = "/TempItems";
            string ItemStoreFolder;
            
            if (ViewState["tempimagespath"]==null)
            {
                Guid itemtemp = Guid.NewGuid();
                TempImages tempimagespaths = new TempImages();
                tempimagespaths.Folderid = itemtemp;
                tempimagespaths.Owner = this.User.Identity.Name;
                tempimagespaths.Created = DateTime.UtcNow;
                tempimagespaths.Folderpath = itemtemp.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Year.ToString();
                DataRepository.TempImagesProvider.Insert(tempimagespaths);
                ViewState["tempimagespath"] = tempimagespaths.Folderpath;
                ItemStoreFolder = tempimagespaths.Folderpath;
            }
            ItemStoreFolder = "/" + ViewState["tempimagespath"].ToString();

            string viewpath = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/Images";
            string documentspath = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/Documents";
            string flashmediapath = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/AdobeFlash";
            string mediapath = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/Media";
            string templatespath = GenericRootFolder + "/Templates";
            //creating folders
            System.IO.Directory.CreateDirectory(Server.MapPath(viewpath));
            System.IO.Directory.CreateDirectory(Server.MapPath(documentspath));
            System.IO.Directory.CreateDirectory(Server.MapPath(flashmediapath));
            System.IO.Directory.CreateDirectory(Server.MapPath(mediapath));

            RadEditor1.ImageManager.EnableImageEditor = true;
            RadEditor1.ImageManager.ViewPaths = new string[] { viewpath };
            RadEditor1.ImageManager.UploadPaths = new string[] { viewpath + "/Upload"};
            RadEditor1.FlashManager.ViewPaths = new string[] { flashmediapath };
            RadEditor1.MediaManager.ViewPaths = new string[] { mediapath };
            RadEditor1.DocumentManager.ViewPaths = new string[] { documentspath };
            RadEditor1.TemplateManager.ViewPaths = new string[] { templatespath };
        }

1 Answer, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 09 Oct 2008, 04:23 PM
Hey Vjeran,

Without being able to access your TempImages class I had to do a little working around the problem, but I was able to pull up the Upload dialogue by making the following modifications:

            string viewpath = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/Images";  
            string viewpath2 = GenericRootFolder + TempStoreFolder + ItemStoreFolder + "/Images/Upload";  
            //Made extra viewpath for Upload folder  
 
            System.IO.Directory.CreateDirectory(Server.MapPath(viewpath));  
            System.IO.Directory.CreateDirectory(Server.MapPath(viewpath2));  
            // ^ create upload folder, you never created it previously  
 
            RadEditor1.ImageManager.EnableImageEditor = true;  
            RadEditor1.ImageManager.ViewPaths = new string[] { viewpath };  
            RadEditor1.ImageManager.UploadPaths = new string[] { viewpath + "/Upload"};  
            // ^now the Upload folder exists, so when you navigate to it, you can upload files 

Let me know if that solves your problem, as those two extra lines are letting me upload just fine.
Tags
Editor
Asked by
Vjeran
Top achievements
Rank 2
Answers by
Serrin
Top achievements
Rank 1
Share this question
or