Skip to main content
Inspiring
November 16, 2010
Question

Users uploading content

  • November 16, 2010
  • 3 replies
  • 577 views

Hi Folks,

I've got a basic setup where users can submit to a notice board, a title, body text and a image.

Typically, the text can have special charactors which breaks my pages, and the images are always way to big.

Are there any client side techologies that I could use to tell if images  were too big and if a string had special charactors in it?

Basically, is there a way I can make it fool proof?


Many thanks

    This topic has been closed for replies.

    3 replies

    Inspiring
    November 17, 2010

    What I would probably due for the text is use something like a wysiwyg editor like FCKeditor to enter it as html, which should help on some text. You could them parse the form text on form submit using REGEX to search for the characters that would break the page, and either change them or strip them out/reformat it. Not really what you want to do, but there isnt alot of client side stuff unless you are good with ajax libs.

    For the image uploading, again there isnt alot of client side stuff, unless again you are good with ajax libs to check image client side. I dont know of how to do it exactly using ajax, but I know its possible. PHP and other languages seem to do it.

    You could use something like a Flash File uploader which can check file size prior to uploading. ASFusion has one you can downoad and edit to work with some patience. There are a few that you can buy as well that may work..google "Flash File Uploader" and you can see some in action.

    hth

    Inspiring
    November 16, 2010

    For the images, I think you'll have to upload them first.  If the previous responder thinks it can be done in js, I'd be interested in the details.

    For the special characters, what sort of characters are you talking about and how do they break your page? 

    Inspiring
    November 16, 2010

    For the images, I think you'll have to upload them first.  If the previous responder thinks it can be done in js, I'd be interested in the details.

    I suspect that doing this on the client with Javascript is probably asking for too much, especially if you're going for a fool proof site.  Apparently client side image resizing is possbile in FF3 and Chrome, but you'd leave out users of IE and other browsers, see library demo'd in link below.  Note that I have not used this JS library

    http://kimsal.com/shrinker/

    Inspiring
    November 16, 2010

    Hi,

    yes you can do that in Javscript.