Upload doesn't work??

2 posts, 0 answers
  1. Vjeran Ivičić
    Vjeran Ivičić avatar
    24 posts
    Member since:
    Oct 2005

    Posted 07 Oct 2008 Link to this post

    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 };
            }
  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 09 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top