trailing slash in file paths causing upload problems

  •  04-01-2010, 9:43 PM

    trailing slash in file paths causing upload problems

    Though it's not pointed out in the documentation, seems CuteEditor seems to want paths specified for Images, Media, Flash & Documents to NOT have a trailing slash.
     
    <security  name="FilesGalleryPath">~/uploads</security>
     
    editor.FilesGalleryPath = "/Uploads"
     
    But what if I want to specify the root directory for any of these? What do I put in? Seems like an empty string should indicate the root folder:
     
    editor.FilesGalleryPath = ""
     
    But doing this causes either permission warnings, HTTP 500: Permission denied errors or VBScript "Path Not Found" errors for me—depending on the server and configuration.
     
    So of course I tried a forward slash instead. That seems to work okay. Until you I tried uploading a file. The uploader chokes on this, and I got
     
    Server side exception, failed to upload
    Unable to write file to temp directory
     
    from the Flash uploader and

    Permission denied
    /cuteeditor_files/Dialogs/aspuploader/include_aspuploader.asp, line 489

    from the iFrame version.

    When I did manage to get it to work on one server, I started getting double forward slashes prepended to my uploaded file links. This is a problem because CuteEditor—when using absolute URLs—will convert any link beginning with // to http://. So I end with links like
     
    http://myfile.pdf
     
    In exasperation, I also tried variations like:
     
    editor.FilesGalleryPath = "/."
    editor.FilesGalleryPath = "../"
     
    The first one actually seems to work. My links get inserted like this:
     
    /./card_code.html
     
    But with absolute URLs on, they get cleaned them up. Still, this seems like a hack at best, which I wouldn't recommend.
     
    So how the heck do you correctly specify the root folder for any of these? And why aren't forward slashes automatically removed if they're not appropriate, rather than causing everything to blow up?
     
    Going back to using just a forward slash, I managed to fix the "http://" problem above by changing this line in cuteeditor_files\Dialogs\upload_handler.asp:
     
    Response.Write "<script language=javascript>parent.UploadSaved('" & FilePath &"/" & File.FileName & "','"&FilePath&"');</script>"
     
    to this:
     
    If Right(FilePath,1) <> "/" Then
      outputPath = FilePath & "/" & File.FileName
    Else
      outputPath = FilePath & File.FileName
    End If
    Response.Write "<script language=javascript>parent.UploadSaved('" & outputPath & "','"&FilePath&"');</script>"

    Seems like something like this should have been there already.
View Complete Thread