tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

TActiveFileUpload problem #301

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. put a simple TActiveFileUpload on a empty page
2. try to upload a file
3. you get "page not found" error (ex: 
index.php?page=TestPage?TActiveFileUpload_InputId=ctl0_content_AFUdocUpload&TAct
iveFileUpload_TargetId=ctl0$content$AFUdocUpload$Target)

What is the expected output? What do you see instead?
It seems that is an error in the js script, when it's trying to build 
form.action.

What version of the product are you using? On what operating system?
Prado 3.1.7 Windows XP 

Please provide any additional information below.
The posible solution is to modify the "activefileupload.js" file in 
"framework\Web\Javascripts\source\prado\activefileupload" folder, line 41: 
"this.form.action += 
'&TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId=
'+this.options.targetID;"

Original issue reported on code.google.com by foravi...@gmail.com on 14 Jan 2011 at 10:17

GoogleCodeExporter commented 9 years ago
This has been fixed quite some time ago in r2728.

Original comment by rojaro@gmail.com on 29 Apr 2011 at 9:33

GoogleCodeExporter commented 9 years ago
Hi, rojaro and thanks for answering this issue. I also ran into the same 
problem and I think this issue could be different than the one fixed in r2728. 
Let's take a look at 
/trunk/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.
js

line 41 which is : this.form.action += 
'?TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId=
'+this.options.targetID;

This means no matter what this.form.action is before that line, it will be 
appended with '?...'
In the case this.form.action value is something like 'index.php?page=MyPage' , 
after line 41, this.form.action will be 
'index.php?page=TestPage?TActiveFileUpload_InputId=...&TActiveFileUpload_TargetI
d=...' => requested page would be 'TestPage?TActiveFileUpload_InputId' which 
cannot be found.

The solution which fixed my app. is :
line 41: this.form.action += (this.form.action.indexOf('?')>0 ?'&' 
:'?')+'TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_Targ
etId='+this.options.targetID;

Thanks again and I hope you'll find this useful. If something isn't clear 
enough or you need more info about this scenario, please let me know.

Original comment by petre.an...@gmail.com on 2 May 2011 at 7:59

GoogleCodeExporter commented 9 years ago
Nice find :)
Properly fixed now in r2897.

Thanks for your report & greetings from Hamburg / Germany
- rojaro -

Original comment by rojaro@gmail.com on 2 May 2011 at 8:15

GoogleCodeExporter commented 9 years ago

Original comment by rojaro@gmail.com on 2 May 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Thanks for reading it and I'm happy to be of help :)

And greetings from Bucharest / Romania :)

Anditza

Original comment by petre.an...@gmail.com on 2 May 2011 at 8:34

GoogleCodeExporter commented 9 years ago
I'm not exactly sure whether this can cause any issues in real world (ie. 
whether the form.action field can be equal to just the query part of an url at 
any times), but the semantically correct version of the check

  this.form.action += (this.form.action.indexOf('?')>0 ? '&' : '?')+'TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId='+this.options.targetID;

is actually

  this.form.action += (this.form.action.indexOf('?')>=0 ? '&' : '?')+'TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId='+this.options.targetID;

or

  this.form.action += (this.form.action.indexOf('?')!=-1 ? '&' : '?')+'TActiveFileUpload_InputId='+this.options.inputID+'&TActiveFileUpload_TargetId='+this.options.targetID;

as string.indexOf() returns -1 if the substring is not found, not 0 or false.

Original comment by google...@pcforum.hu on 30 Jul 2011 at 7:17

GoogleCodeExporter commented 9 years ago
The string.indexOf() fix has been committed as r3027, thank you

Original comment by ctrlal...@gmail.com on 19 Aug 2011 at 1:46