XUpload - Upload to multiple locations

Message
Author
rkiss
Posts: 1
Joined: Apr 12, 2007 11:53 am

Upload to multiple locations

#1 Postby rkiss » Apr 12, 2007 11:56 am

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

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

#2 Postby PilgrimX182 » Apr 12, 2007 1:41 pm

You can do this in Pro version.
I've given quick hack for Free version somewhere on this forum, try to find it.

someone1
Posts: 3
Joined: Apr 12, 2007 11:49 pm

Hey

#3 Postby someone1 » Apr 12, 2007 11:53 pm

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!

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

#4 Postby PilgrimX182 » Apr 13, 2007 6:36 am

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: Select all

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

someone1
Posts: 3
Joined: Apr 12, 2007 11:49 pm

#5 Postby someone1 » Apr 13, 2007 2:20 pm

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!

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

#6 Postby PilgrimX182 » Apr 16, 2007 5:30 am

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.

someone1
Posts: 3
Joined: Apr 12, 2007 11:49 pm

#7 Postby someone1 » Apr 16, 2007 5:35 am

Thanks anyway, i found a very dirty workaround, though I needed to modify your script quite a bit


Return to “XUpload”



Who is online

Users browsing this forum: No registered users and 0 guests