| View previous topic :: View next topic |
| Author |
Message |
rkiss
Joined: 12 Apr 2007 Posts: 1
|
Posted: Apr 12, 2007 11:56 am Post subject: Upload to multiple locations |
|
|
Hi,
Is it possible to set the upload destination folder as a variable during the upload...
I have a real estate website and my "uploads" folder structure has the following subfolders: "images", "vr_tours", "documents"
How can I tell the script to upload new images to "images" folder, new vr tours to "vr_tours" folder, etc?
Thank you,
Regards,
Roman |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: Apr 12, 2007 1:41 pm Post subject: |
|
|
You can do this in Pro version.
I've given quick hack for Free version somewhere on this forum, try to find it. |
|
| Back to top |
|
 |
someone1
Joined: 12 Apr 2007 Posts: 3
|
Posted: Apr 12, 2007 11:53 pm Post subject: Hey |
|
|
Hey, i'm using the free version and would also like to specify the folder location via GET or POST, i even found how to read GET and POST using PERL. What i tried to do is find the GET data before including the XUploadConfig.pm file which used $name for the target directory. the path was stored into $name, but I guess the upload doesn't work this way.
I'm new to PERL and only needed an upload script with no limitations and a progress bar. XUpload seemed like the best choice, and so far is, but i need to specify user specific upload directories for a per user basis.
I've scoured these forums to find no such hack given for free, but maybe if i post the "modifications" i made, you can tell me if i'm right/wrong?
All i really need to know is how to read POST data in the upload.cgi.
Also, if i want to upload two files in one form, but the free version only allows one, can i still upload the second file via PHP (after sending all POST/GET data to PHP script after PERL upload?)
Thanks for your time! |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: Apr 13, 2007 6:36 am Post subject: |
|
|
Ok. Here goes quick hack for specific upload folder:
you need to create input field with name 'ext_folder' in your upload form containing sub-folder name where you want upload to.
e.g. <input type="hidden" name="ext_folder" value="users">
then in your upload.cgi find line: "my @params = $cg->param;" and add this code below:
| Code: | my $ext_folder = $cg->param('ext_folder');
$ext_folder='' if $ext_folder=~/\.\./;
$c->{target_dir}.= "/$ext_folder" if $ext_folder; |
About 2 files upload: no, it's not possible to upload 2nd file with PHP |
|
| Back to top |
|
 |
someone1
Joined: 12 Apr 2007 Posts: 3
|
Posted: Apr 13, 2007 2:20 pm Post subject: |
|
|
Thankyou very much!, i was trying to do soemthign similar but had no idea how to grab POST data in PERL
Is there a way to specify if the uploading file should redirect to a new page? Say i want to create a way to upload multiple files myself by using Javascript, can i add a GET command to the script to tell it to redirect to a new page if the new var is equal to 1?
Thank you soo much! |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: Apr 16, 2007 5:30 am Post subject: |
|
|
| As far as I understand you, it is not possible. Upload is possible only with POST, no way to initiate upload after GET or redirect. |
|
| Back to top |
|
 |
someone1
Joined: 12 Apr 2007 Posts: 3
|
Posted: Apr 16, 2007 5:35 am Post subject: |
|
|
| Thanks anyway, i found a very dirty workaround, though I needed to modify your script quite a bit |
|
| Back to top |
|
 |
|