p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 (http://p2p.wrox.com/forumdisplay.php?f=252)
-   -   Chapter 6 FCKeditor image upload (http://p2p.wrox.com/showthread.php?t=64184)

hdpark November 29th, 2007 06:05 PM

Chapter 6 FCKeditor image upload
 
Hi Imar,

I am trying to upload images files. I did like this:
1. <appSettings>
    <add key="FCKeditor:UserFilesPath" value="/UserFiles"/>
  </appSettings>

2. FCKeditor screen>Insert/Edit Image>Click Upload Tab>Browse Image>Send it to the Server

3. Then I have this error message: "This file uploader is disabled. Please check the "editor/filemanager/upload/asp/config.asp" file

4. So I copied those codes from "editor/filemanager/upload/asp/config.asp".

' SECURITY: You must explicitelly enable this "uploader" (set it to "True").
Dim ConfigIsEnabled
ConfigIsEnabled = False

' Path to user files relative to the document root.
Dim ConfigUserFilesPath
ConfigUserFilesPath = "/UserFiles/"

Then what shall I do?

Your kind advices would be really appreciated.






Imar November 29th, 2007 06:27 PM

Hi there,

There's a .js file (fckconfig.js) in the main editor folder where you can configure this.

If that doesn't help, check out the FCK Editor site and their support forums.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

hdpark November 29th, 2007 07:21 PM

Hi Imar,
I found some codes in fckconfig.js file like follows.
What do I change here?

Thanks,


FCKConfig.ImageUpload = true ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/asp/upload.asp?Type=Image' ;
// PHP // FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/php/upload.php?Type=Image' ;
FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png)$" ; // empty for all
FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one


Imar November 29th, 2007 07:28 PM

Abd did you change ConfigIsEnabled = False to True in your previous message?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

Imar November 29th, 2007 07:32 PM

You may also want to take a look here: http://www.cubecart.com/site/forums/...65#entry128265

It's quite old, and targeted at PHP but the same principles apply....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

hdpark December 3rd, 2007 03:49 PM

Hi Imar,

1. It was my operation mistake.
   If I use "Image Info" instead "Upload", it's working fine.
   Thanks for your kind help.

2. My next question is how to upload Audio files at FCKeditor?

Thanks,



Imar December 3rd, 2007 04:00 PM

You can use the standard File Uploader of the editor for that....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

hdpark January 28th, 2008 03:46 PM

Hi Imar,

I made file upload codes as follows.
1. When I run it at local PC with "FileUpload1.SaveAs("\UserFiles\" & FileUpload1.FileName)", it is working fine.
2. When I run it at hosting site(discountasp.net), it gives error "is not rooted". Would you please advise me what codes I should use?

Thanks,
HD


    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("\UserFiles\" & FileUpload1.FileName)
                lblUpload.Text = "File name: " & _
                   FileUpload1.PostedFile.FileName & "<br>" & _
                   "File Size: " & _
                   FileUpload1.PostedFile.ContentLength & " kb<br>" & _
                   "Content type: " & _
                   FileUpload1.PostedFile.ContentType
            Catch ex As Exception
                lblUpload.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            lblUpload.Text = "You have not specified a file."
        End If
    End Sub


Imar January 28th, 2008 06:36 PM

Hi hdpark,

You may need to map UserFiles to a physical path first using Server.MapPath. E.g.:

FileUpload1.SaveAs(Server.MapPath("/UserFiles/") & FileUpload1.FileName)

If that doesn't help, can you post the exact error message? I doubt it's just "is not rooted"...

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

hdpark February 14th, 2008 08:05 PM

Hi Imar,

I have got the physical path from hosting company, then it is working fine with codes "FileUpload1.SaveAs("e:\web\myaccount\htdocs\UserF iles\" & FileUpload1.FileName".
But your instruction looks like more generic. When I use your instruction "FileUpload1.SaveAs(Server.MapPath("/UserFiles/") & FileUpload1.FileName)", I have error message "Failed to map the path '/UserFiles/'".
Is there anyway I can use your instruction style?

Thanks Imar for your kind help,





Imar February 15th, 2008 04:27 AM

Hi hdpark,

Server.MapPath maps a virtual file or folder to a physical one. For example, if you have a folder called UserFiles at the root of your web site, and your web site is located at e:\web\myaccount\htdocs, then Server.MapPath should return e:\web\myaccount\htdocs\UserFiles
What do you get when you use Server.MapPath and output its return value on a label control? E.g.:

Label1.Text = Server.MapPath("UserFiles")

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

hdpark February 19th, 2008 11:40 AM

Hi Imar,
I needed \(back slash) after UserFiles like this.
FileUpload1.SaveAs(Server.MapPath("UserFiles\") & FileUpload1.FileName)

Thanks for your kind help.

I have another question about DropDownList.
I used it from your codes in Chapter 6 as this: lstBlogEntry.SelectedIndex = -1
When I enter this routine, "-1" brings 1st selection from data. I want to bring specific value (it is in Public pubVars.pubBlogID) and set this value to this DropDownList. I tried it like these two:
1. lstBlogEntry.SelectedIndex = Convert.ToInt32(pubVars.pubBlogID)
2. lstBlogEntry.SelectedValue = Convert.ToInt32(pubVars.pubBlogID)

But I do not have right result. Can you please advise me about this?
I really appreciate your kind help always.

Thanks,



Imar February 19th, 2008 01:04 PM

Hi there,

Can you explain your problem in more detail? I have no idea what you're talking about.

Maybe you can open a new thread for it? If it's related to the Instant Result book, post it here, otherwise please select an appropriate other category here at p2p.wrox.com

Cheers,

Imar


All times are GMT -4. The time now is 01:50 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.