• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Accessing uploaded file via processing script

Accessing uploaded file via processing script 16 years 10 months ago #3592

In the form processing script, I can use the $processform[] array to access all my form fields except file uploads. Both $processform (RSForm's syntax) and $_FILES (PHP's standard way of handling uploaded files) are blank, even though the file is indeed uploaded. Elsewhere in RSForm, of course, the syntax is {myfile}, but what about in the PHP script?

What I'm trying to do is move the file to a directory of my choosing and restore the original filename (without the long number that RSForm adds to it), for use in another Joomla extension. It should be trivial, a single function call in PHP. But I have to know where the file is at the time the script is run. For starters, I don't even know whether the script is run before or after RSForm moves the file from the standard temp location to its uploads directory, but either way, it would be a call to either move_uploaded_file() or rename(), if I could just find the file. I have searched the Knowledgebase and the Internet in general but haven't found any examples of accessing uploaded files inside the script.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3640

Any clues on this? I'm completely stalled in my project until I know the answer. Thanks!
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3663

I asked support to developer for the same problem.

It works to submit the route of the data when you do not use any script and it is stored in RSFORM_SUBMITTED_DATA

But when you try to use it to submit data to your table, the script does not work. It is like the script needs some additional code to detect the type of component and how to store the route to the file uploaded.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3677

I don't actually know yet whether there is a \"problem\" or not - I suspect I just don't know what variable I should be accessing. The rest of my script works (well, actually I haven't figured out how to get the value of checkboxes either, but...), and I am assuming that if I know the right object/variable name and usage, I should be able to ascertain the path to the uploaded file.

I'm not sure what you mean by \"RSFORM_SUBMITTED_DATA\" - in my installation of RSForm, there is no table named that, nor directory on the server. Is that an object name? If so, what properties and methods does it have? I googled it, but the only hit was your post.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3693

RSFORM_SUBMITTED_DATA is not a file is a default database table created by RSForm.

Developer has solved this problem with the new version which includes a mapping tool to set the database table.

Use the Mapping to set your table database and field to store the route of the uploaded file:

www.rsjoomla.com/index.php/rsformpro.mappings/Database-Mappings.html
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3698

RSFORM_SUBMITTED_DATA is not a file is a default database table created by RSForm.
My installation doesn't have any database table with that name, nor anything similar.
Developer has solved this problem with the new version which includes a mapping tool to set the database table.
As far as I can tell, I already have the newest version: 1.0.4
I'm interested in what you are trying to share with me, but that link gives a 404 error.
Also, I noticed that your link's URL includes \"rsformpro\" in it, but I just have the regular RSForm, not Pro. When I bought it (in April), I don't remember even seeing RSForm Pro as a choice - perhaps the Pro version was created after that...?

Anyway, I'm confident that there is a simple answer to my question. I just want to know a variable, object, or database access SQL that I can use to determine the location of the uploaded file from the point of view of a script in the \"Script called on form process\" textbox. An additional question would be how to determine the status of a checkbox - I can't figure that out either.

If the data record in the \"jos_forme_data\" table has already been inserted at the time the script runs, and I could access it, I could parse the \"params\" field to get the filename. But I don't know how to get the id of the newly created record.

Surely someone has a list of the objects available to the processing script ($processform is one example; I bet there are more) and what methods and properties they have. I am having to guess everything from very few examples - most of what I know I got from small scraps of syntax I could extract from the examples on this page. Uploaded files and checkboxes are not mentioned.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3699

(oops - my PC did something strange and my last post was posted twice. I can't seem to delete a post, but I can edit. If an admin person wants to delete this junk post, thanks!)<br><br>Post edited by: OsakaWebbie, at: 2008/07/13 09:12
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3755

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Hello !

The mapping plug-in has been released !

Please update to the latest version of RSform!Pro. There you will find instructions on how you can get it !

Thanks
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3766

Do I really need a different (and more expensive) version of RSForm, plus a plugin that has just been released, in order to have visibility of the values of two standard form field types? This seems like a very basic thing that would be part of the regular (not Pro) RSForm itself, not a plugin. And no one has told me yet how this Mapping plugin will help anyway - the only page I was directed to is a dead link.

Let me try one more time: What variable(s), array(s), or object(s) contains information on uploaded files and on checkbox fields, as seen from the vantage point of a PHP script in the \"Script run on form processing\" spot in RSForm? I don't understand why this isn't an easy question.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3782

I found my own answers eventually, so I'll post them for completeness (for those who might find this thread later). Learning to use the PHP function r_print() was a key to determining what was going on with various arrays that the system was producing.

The PHP superglobal $_FILES is indeed visible to the processing script - the only problem was that I was addressing the parts of the array incorrectly. In my first post on this thread, I said I had tried $_FILES without success. But the correct syntax is $_FILES[tmp_name']. With that correction, I had no problems accessing the file in the normal PHP way and doing anything I want with it.

Regarding the checkbox, my mistake was not not filling in the Default Value for the checkbox field. When the box was checked, $processform existed, but since the value was null, my if statement evaluated false either way.

Perhaps this info will help someone, or perhaps not, but there it is...:unsure:
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3794

The function of buying database mappings produces an error.

Can i download it somewhere on this site ?

Mark :woohoo:
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3796

Mark, for best response I suggest that you either start a new thread with your question (with a matching Subject Title to get people's attention) or submit a Trouble Ticket directly to the developers. This thread wasn't really about mappings - it's just that someone suggested it as a solution for me (which it was not - my question had a much simpler answer, as I suspected it would). I have no idea how you would get mappings, as I don't even own Pro. Good luck.
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3834

You can choose the route of the uploaded file in the component parameter \"Destination\"

If you want to store the route of the uploaded image in your own table then the Mapping plugin makes your life much easier.

I have paid the pro license and mapping plugin and the payback saves me a lot of headaches and time of hard coding.:)<br><br>Post edited by: alexenergy, at: 2008/07/24 21:56
The administrator has disabled public write access.

Re:Accessing uploaded file via processing script 16 years 9 months ago #3836

Thank you, but I am doing this dynamically, working with the database tables of a different Joomla extension, so I don't know the desired destination path for the file until the time that the script runs. Also, a custom script is needed not just for saving the file, but also retrieving information from and inserting records into multiple database tables, so even if I had Mappings and it handled the file in a way that was useful, I would still need the complex script for other reasons. Basically, the two RSForms I created and their accompanying scripts are a custom front-end interface for an extension that only provides a overly complex back-end.

My scripts are now working fine. Now that I have solved my syntax issues, I am able to use the standard PHP superglobal array $_FILES and the function move_uploaded_file() to do what I need to do.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!