| View previous topic :: View next topic |
| Author |
Message |
giorrrgio
Joined: 04 Aug 2008 Posts: 5
|
Posted: Aug 04, 2008 1:41 pm Post subject: multiple file upload each with custom parameters |
|
|
Hi there,
I've an upload form with which users can upload a file, specyifing some custom fields.
Since I have to post all this data with ajax calls, I followed some hints on this forum and modified this way upload.cgi:
| Code: |
print"<HTML><BODY><Script>";
for my $f (@files)
{
print "window.top.window.updateUploadDiv('$f->{file_name}' , '$f->{file_name_orig}' , '$f->{file_size2}' , '$f->{file_size}' , '$f->{file_status}');";
}
print"</Script></BODY></HTML>";
|
Now my issues:
I'd like to pass all the custom fields to that javascript function, in addition to other file related data.
I saw something related to @har variable, but I'm not familiar with perl, so please help
Second issue: if I want to make this form multiupload, how can I manage separate custom fields for each file I upload? (E.G. if user uploads 4 songs, I need him to specify title and genre for each song in separate fields). It seems that custom fields are treated without the possibility to do what i need.
I'm using the pro version.
Thanks |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1055 Location: Undisclosed location
|
Posted: Aug 06, 2008 1:18 pm Post subject: |
|
|
1) What file-related fields fo u need more?
2) I think this is pretty easy: in xupload.js clone this part of code:
| Code: | if(enable_file_descr==1)
{
var new_row_descr = document.createElement( 'input' );
new_row_descr.type = 'text';
new_row_descr.name = element.name+'_descr';
new_row_descr.className='fdescr';
new_row_descr.setAttribute('maxlength', 128);
var div2 = document.createElement( 'div' );
div2.className = 'xdescr';
div2.appendChild( document.createTextNode('Description:') );
div2.appendChild( new_row_descr );
new_row.appendChild( div2 );
} |
and replace there in new code '_descr' to e.g. '_title', 'Description:' to e.g. 'Title:'
Then in upload.cgi after
| Code: | | $fhash->{file_descr} = $cg->param("$k\_descr"); |
add
| Code: | | $fhash->{file_title} = $cg->param("$k\_title"); |
and after
| Code: | | '$f->{file_status}' |
add
| Code: | | ,'$f->{file_title}' |
to send it back to your JS function |
|
| Back to top |
|
 |
giorrrgio
Joined: 04 Aug 2008 Posts: 5
|
Posted: Sep 22, 2008 9:25 am Post subject: |
|
|
Hi,
your solution is good but I've found a problem with special characters.
My website uses utf-8 as charset and if put special characters in the title field the upload freezes at 100%.
Any idea?
Thanks |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 1055 Location: Undisclosed location
|
Posted: Sep 22, 2008 9:53 am Post subject: |
|
|
| No idea actually. Try to disable email notifications first in config. Then check error_log, make hidden xupload iframe visible, probablt some errors there. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|