Add a sql request in process.php

Upload core product.
Post Reply
skum3
Posts: 7
Joined: Fri Jan 02, 2009 10:55 pm

Add a sql request in process.php

Post by skum3 »

Hi, i use your PHP sample for JFileUpload, and i would like to add a sql request in process.php in order to know all files which are in the upload dir (so for each file uploded, i use an INSERT sql request in my database). I had put this request in the two upload functions of process.php ('do_post_upload' and 'do_put_upload'), just before the sucess upload message ('file_name' uploaded successfully.). It runs well when the file to upload is not chunked, but when it is chunked, there is an insertion in my database for each chunk of the file. So i think my sql request is not on the good place, so where do i place my sql request in order to have one insert for one file uploaded, chunked or not? Thanks in advance !

skum3
Posts: 7
Joined: Fri Jan 02, 2009 10:55 pm

Re: Add a sql request in process.php

Post by skum3 »

I have forgotten that i have another question which is the following : is it possible to disabled the folder upload? I have seen the 'folderdepth' param but when i put '0' all the subdirectories are not uploaded, but the first folder is still uploaded... Thanks !

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Add a sql request in process.php

Post by support »

First, to disable folder upload, enable "resources" parameter with i18n.properties.
Then in i18n.properties, uncomment the following line:
filechooser.dialog.selectionmode=filesonly
You have a tutorial about i18n at:
http://www.jfileupload.com/products/jfi ... ation.html

About PHP and SQL, you let it where you have it but test if it's a chunk or not (check 'chunkid' in POST array). If it's not a chunk then run your SQL request. If it's a chunk then skip the SQL. And add your SQL again after the fclose($fout); in if ($chunkid == $chunkamount) block.

Does it help ?

skum3
Posts: 7
Joined: Fri Jan 02, 2009 10:55 pm

Re: Add a sql request in process.php

Post by skum3 »

I would like to say that support is very good, and I congratulate you. All is now running as I want. Thanks a lot for your help and your quickly response !

Post Reply