Have been trying to get a RTE plugin working that will allow upload of
images.  The YUI verion is almost there but will not play well with
browsers.

The plugin from here 
http://allmybrain.com/2008/11/06/example-yui-image-upload-with-yui-260/
I modified to get Javascript to make an asynchronous call to this
function in the view:

def uploadimage(request):
        try:
                upload_full_path = settings.CONTENT_IMAGES

                upload = request.FILES['image']
                dest = open(os.path.join(upload_full_path, upload.name), 'wb+')

                for chunk in upload.chunks():
                        dest.write(chunk)

                dest.close()

                result='{status:"UPLOADED",image_url:"%s%s"}' %
(settings.CONTENT_IMAGES_URL, upload.name)

                return_data = HttpResponse(result,mimetype='Content-Type: text/
html')

        except Exception, e:
                return_data = HttpResponse("Error in uploading image")

        return_data.flush()

        return return_data

The plugin was written for turbon gears/php and there is a tg example
here:

http://allmybrain.com/2007/10/22/yui-image-uploader-example-with-turbogears/

Firefox/Mac works perfectly.  Safari downloads the image instead.  No
version on PC appears to do anything, (but only have Mac for local
testing.)
Have tried every possible permutation of the content-type, Content-
Type and text/html definitely is the way to go.  Various threads on
python refer to the need to open the file for reading as rb to make
sure windows knows it is binary, but not sure how to do that as the
response data is already in memory.

In desperation I have also tried to implement image upload in TinyMCE
- can't get FileBrowser working on PC.  and FCKeditor no modifiable
image upload that I could find.  So I am back with YUI and hoping
someone can suggest something to try....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to