XUpload - set max_file_size within form

Message
Author
golgotha
Posts: 3
Joined: Nov 18, 2006 1:34 pm

set max_file_size within form

#1 Postby golgotha » Nov 18, 2006 1:37 pm

Hi, I just purchased xuploadpro.

I have 3 questions:

1. What I would like to do, is have the max-file-size variable dynamic based on the user using the form.
For example, in mysql table, each user has their own custom max_file_size parameter. With PHP, I would like to deliver that custom max_file_size to the upload.cgi.
Can this be done?

2. In the Xupload free version, you could specify in the form what filetypes were permitted. However, I don't see it in the pro version. How can I specify specific filetypes within the form itself? (so I can have different forms allowing different filetypes)

3. There are many unknown variables that are certain to change behaviors but are undocumented. For example, xmode, css_type and others. Is there documentations somewhere describing all of these and their behaviors?


Thanks!

rob1984
Posts: 8
Joined: Nov 16, 2006 5:46 pm

#2 Postby rob1984 » Nov 18, 2006 6:33 pm

i don't know the answers but i do have 1 question, did it work for you to change the extension of upload_Form.html to upload_form.php ?
If I do this, i get an error (file not found)

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

#3 Postby PilgrimX182 » Nov 20, 2006 6:21 am

golgotha,

1) It's unsecure to have max-file-size variable in form on user side, thay can just edit it manually and upload any size they want. Right now we're using xmode hidden field to specify upload mode. Take a look into XUploadConfig.pm for these modes examples. Anyway, if you feel ok with this, I can create quick hack for you.

2) That is correct. Now using file extensions from XUploadConfig, so you don't need to specify them in 2 places, but in one config only.

3) xmode - upload mode you wanna use. Modes are specified in XUploadConfig.pm

css_name - name of CSS style, specified in XUploadConfig.pm, style
files should be in Styles folder

tmpl_name - name of HTML template, specified in XUploadConfig.pm, style
files should be in Templates folder


rob1984, should work all right if you can execute php files in that folder.

golgotha
Posts: 3
Joined: Nov 18, 2006 1:34 pm

#4 Postby golgotha » Nov 20, 2006 9:33 am

Thanks for the answers Pilgrim.

2 and3 are answered and I understand.

On number 1, I am storing the max_file_size in a mysql table for each user. How about assigning that max_file_size as a session variable. My problem is, how do I get the XUploadconfig.pm to read a php session variable?

Thanks!

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

#5 Postby PilgrimX182 » Nov 20, 2006 12:09 pm

I'm sorry to tell you this, but it's not so easy to implement now. Possible, but require time that I don't have now. The easiest way is to check for filesize and user limit in your PHP script After upload, then decide keep the file or delete.

I will think about this feature, maybe will do some magic in next version, not sured, too unsecure.

chrisdpucci
Posts: 9
Joined: Oct 11, 2006 6:15 pm

#6 Postby chrisdpucci » Nov 20, 2006 1:56 pm

golgotha,

Why don't you do some pre-upload php work and then set the xmode variable based on the users upload allowances?

golgotha
Posts: 3
Joined: Nov 18, 2006 1:34 pm

#7 Postby golgotha » Nov 21, 2006 1:22 pm

ah, so I guess the easiest way to set this up is to use separate xmode's for each scenario.

That will work.

Thanks

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

#8 Postby PilgrimX182 » Nov 22, 2006 7:03 am

Yea. This will work if you have only 2-5 distinct limit amounts.
Won't work if you have individual limit for every user (need number of xmodes = number of users this in case).
:)

Ceroscuro
Posts: 2
Joined: Nov 23, 2006 12:59 am

#9 Postby Ceroscuro » Nov 23, 2006 11:39 pm

How would you go about setting this just from a value within the form?

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

#10 Postby PilgrimX182 » Nov 24, 2006 6:41 am

Ha. The problem is that we can read form value only after full upload complete, so can't save the traffic that way. There is a solution, but once again not secure.
But as soon as so many users requesting it I will implement this soon.