XUpload - How to use values from the upload form in the upload.cgi ?

Message
Author
rayfresh
Posts: 3
Joined: Oct 29, 2008 12:42 am

How to use values from the upload form in the upload.cgi ?

#1 Postby rayfresh » Oct 29, 2008 12:51 am

Hello,

I added an input named "code" in my upload form.
I searched everywhere but i don't understand how to do this :

1 - I have a random code in my php form (here : 521f26yu4j8k54g6hj)
2 - my form is submitted to the upload.cgi
3 - my code (variable) replace my filename

Example :
file uploaded = "archive-member-1346.zip"
final filename = "521f26yu4j8k54g6hj.zip"

Could you help me to do this ?

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Oct 29, 2008 7:17 am

in upload.cgi find:

Code: Select all

$fn = substr($fn,0,$c->{max_name_length});
and add line below:

Code: Select all

$fn = $cg->param('code');
Where code is name of your hidden field with random in html form (<input type='hidden' name='code' value='123456789'>)

rayfresh
Posts: 3
Joined: Oct 29, 2008 12:42 am

#3 Postby rayfresh » Oct 29, 2008 1:26 pm

Code: Select all

oh thank you very much!

just another question...

Can i add name and mail values from form too ?
Can i redirect to a page with these variables ?

print"<HTML><Script>parent.document.location='$redirect_link';</Script></HTML>";

like this :
print"<HTML><Script>parent.document.location='$redirect_link&code=$code&name=$name&mail=$mail';</Script></HTML>";

The syntax is not good...


User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#4 Postby PilgrimX182 » Oct 29, 2008 2:14 pm

Actually POSTing all variables from html form to url_post.
This "parent.document.location=..." code is for situation when url_post is .htm(l) file. Try php file for url_post.
Also can try like this the line above:

Code: Select all

my $mail = $cg->param('mail');

rayfresh
Posts: 3
Joined: Oct 29, 2008 12:42 am

#5 Postby rayfresh » Oct 29, 2008 2:21 pm

YESSS !!!
I get it !

Thank you very much