Ask Your Question
1

file attachment while asking a question does not work

asked 2011-05-31 11:34:32 -0600

Samuel gravatar image

Does this feature expected to work? Instead of being uploaded, a text is appended to the question including the wrong local path to the file (for instance d:/fakepath/myfile.doc instead of d:/myfolder/myfile.doc).

edit retag flag offensive close merge delete

Comments

Looks like whatever is shown in the local path depends on the system. On my machine the path (the directory part of it) is not shown at all, only the local file name. Maybe it is a good idea to normalize the local path to make sure the display is not showing drive letters and local directory structures.
Evgeny gravatar imageEvgeny ( 2011-06-06 18:38:35 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2011-06-01 09:25:02 -0600

Samuel gravatar image

updated 2011-06-01 11:05:58 -0600

Thanks Evgeny. No problem for the technical detail. On my side, Askbot is set up on Redhat 5.5 with mysql and apache.

I have understood what happens.

First, the configuration for file extensions allowed is the same for images and attachments. I was expecting no limitation for attachments. I need to give the possibility to attach log files for instance, but it is not relevant for images. This is the case on askbot.org with doc files. Do you see a reason to limit file extensions for attachments, except the reuse of the function?

Second, there are minor bugs in the attachment pop-up :

  1. if you choose OK without doing anything, it should do nothing, but instead the following text is appended : [file name]()

  2. if you choose a file not allowed (in my example test.txt located in D:\tmp\test.txt on my machine), then you choose OK, the following text is appended : [C:\fakepath\test.txt]()

  3. if you choose a file allowed (for instance askbot.gif), the file is uploaded, then you choose another file not allowed, the error message listing allowed extension does not appear, then you choose ok. The result is the following line appended : [C:\fakepath\askbot.gif](/en/upfiles/13069375968038733.gif).

edit flag offensive delete link more

Comments

I think that issues with the popup are fixed now, as for the reuse of the function - true, that's the reason, also the javascript is reused. As for making separate limitations extension for attachments and images - maybe makes sense, will look into this later.
Evgeny gravatar imageEvgeny ( 2011-06-06 18:36:06 -0600 )edit
btw, very impressive testing :), thanks.
Evgeny gravatar imageEvgeny ( 2011-06-06 18:36:38 -0600 )edit
The cases 1 and 2 are now fixed, but not the 3rd one. In a previous life I was managing a QA team in a software company ;-)
Samuel gravatar imageSamuel ( 2011-06-07 04:03:14 -0600 )edit
I would just like to quickly modify the code to remove the limitations for file upload. I will have a look but maybe you know directly the answer. Is there a variable like ItemType (image or file) available in the request that I can use in the upload function?
Samuel gravatar imageSamuel ( 2011-06-07 11:36:52 -0600 )edit
0

answered 2011-05-31 12:18:36 -0600

Evgeny gravatar image

It should work, but maybe there is a bug when askbot is set up on windows.

Will you be able to debug it? I do not have a windows system here...

The upload function is upload in askbot/views/writers. What is the value of file_url variable in the end of the function?

The debugging can be done for example with pdb, - insert lines somewhere in the function:

import pdb
pdb.set_trace()

Then try to upload attachment, the debugger will pause in the shell and you'll be able to step through the instructions by typing "n" and to find what is the value of the variable - just type the variable name.

Sorry, going in detail, because I don't know if you are familiar with pdb.

Also, could you try checking which directory is used on your system to store uploaded files:

python manage.py shell
>>>from django.conf.import settings
>>>settings.ASKBOT_FILE_UPLOAD_DIR

It should print a path to a directory which must be writable by the server.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2011-05-31 11:34:32 -0600

Seen: 293 times

Last updated: Jun 01 '11