Ask Your Question

Plans to support attachments other than images? [done]

asked 2010-09-30 07:33:12 -0500

Benoit's avatar

updated 2010-10-25 21:05:47 -0500

Evgeny's avatar

I noticed that askbot support uploading of images, so presumably there is infrastructure in place to store binary blobs.

I would like to request support for generic attachments.
I realize we can use a link to a storage location, but it would be nice to have everything using the same front-end.

Not a huge priority, but definitely a nice feature to have in the context of a corporate site.

After thinking about this, I believe this feature could look like this:

  • In the editor, add a new command (ctrl-F ?)
  • ctrl-F brings up a navigation dialog to select the file
  • The selected file is uploaded to a configurable directory.
  • Should automatically add a unique prefix to file name to avoid name clash.
  • A hyperlink (similar to ctrl-L) is linked to any highlighted text.

I believe that would provide an acceptable way to upload (and link to) files.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2010-10-23 19:46:39 -0500

Benoit's avatar

updated 2010-10-24 09:31:31 -0500

Since we don't particularly care about images, but want links to uploaded files, with minor changes, we were able to implement this functionality.

Ctrl-G inserts a link instead of an image. Modify skins/default/media/js/wmd.js and in doLinkOrImage, around line 1742, remove the ! from the start tag to make it a link instead of embedding an image.

In views/, upload function, around line 59:

  • Remove the check on extensions (we don't care to limit to just images)
  • Changed the new_file_name to retain the original file name (instead of a numerical name)

Definitely not appropriate for everyone, but it meets our need.

If this is functionality that askbot would want to provide in the regular release, I would suggest adding a new command/icon to WMD (ctrl-F for file or ctrl-U for upload?).

Probably would require a few more changes to upload to distinguish between images (and limiting extensions) and files (without limits).

edit flag offensive delete link more


I'll try to do something about this today. Also the parsers (prewiewer and the python server side) will requre some change.
Evgeny's avatar Evgeny  ( 2010-10-24 12:29:42 -0500 )edit
Sorry for the typos, commented on the phone in a hurry. Ability to edit comments is also on the list :).
Evgeny's avatar Evgeny  ( 2010-10-24 19:17:27 -0500 )edit

answered 2010-09-30 12:43:42 -0500

Evgeny's avatar

updated 2010-10-25 21:18:52 -0500

edit: made this feature to work, but you still have to specify a list of uploaded file types in file (in the parameter ASKBOT_ALLOWED_UPLOAD_FILE_TYPES, also there is ASKBOT_MAX_UPLOAD_FILE_SIZE - max file size in bytes.

The keyboard shortcut still does not work though (Ctrl-F is probably not a good choice anyway).

This site only accepts pdf attachments.


edit flag offensive delete link more


I don't think attached files would have to show up in the main text field as markdown. I think it would be fine if there was another section (between Question and Answers or at bottom of the page) that would list the various attachments available with a link to launch a download.
Benoit's avatar Benoit  ( 2010-09-30 14:02:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-09-30 07:33:12 -0500

Seen: 831 times

Last updated: Oct 25 '10