Processing uploads to other table
5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 1, 2012 (RSS)
Hello all,
I am using the mail download plugin for the cms.
I want to create a page which processes the data from the incoming mail section to another section, including the attachments.
What is the easiest way to do this?
I came across something with @saveUploadFromFilepath, but i don't know how it works.
Thanks in advance!
I am using the mail download plugin for the cms.
I want to create a page which processes the data from the incoming mail section to another section, including the attachments.
What is the easiest way to do this?
I came across something with @saveUploadFromFilepath, but i don't know how it works.
Thanks in advance!
Re: [GuidovTricht] Processing uploads to other table
By Jason - July 31, 2012
Hi,
What you would need to do is first create the record in the other section. Once this is done, you can use saveUploadFromFilepath() to move the upload. You'll need to call this function once for each file that needs to be moved.
The function is called like this:
$preSaveTempId in your case would be null. So an example call would look like this:
$newRecordNum would be the record number of the record you just created in your new section.
Hope this helps get you started
What you would need to do is first create the record in the other section. Once this is done, you can use saveUploadFromFilepath() to move the upload. You'll need to call this function once for each file that needs to be moved.
The function is called like this:
saveUploadFromFilepath($tablename, $fieldname, $recordNum, $preSaveTempId, $filepath)
$preSaveTempId in your case would be null. So an example call would look like this:
saveUploadFromFilepath("my_section", "uploads", $newRecordNum, null, $upload['filePath']);
$newRecordNum would be the record number of the record you just created in your new section.
Hope this helps get you started
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Processing uploads to other table
Hello Jason,
Thanks for the quick response.
But after this is done, will it delete the upload from the section it came from?
And if not, if i delete it at any of the two section, will it also be deleted from the other?
Thanks for the help,
Guido
Thanks for the quick response.
But after this is done, will it delete the upload from the section it came from?
And if not, if i delete it at any of the two section, will it also be deleted from the other?
Thanks for the help,
Guido
Re: [GuidovTricht] Processing uploads to other table
By Jason - August 1, 2012
Hi Guido,
The saveUploadFromFilePath() function will make a copy of the upload and associate it with your new record. You will then need to delete the upload from the other section. you can do this using the removeUploads() function. This works by passing a WHERE clause to the function.
For example:
Hope this helps
The saveUploadFromFilePath() function will make a copy of the upload and associate it with your new record. You will then need to delete the upload from the other section. you can do this using the removeUploads() function. This works by passing a WHERE clause to the function.
For example:
removeUploads("num = '".intval($upload['num'])."'");
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Processing uploads to other table
Hi Jason,
That's all the info i need right now. Thanks for the quick help! :)
Guido
That's all the info i need right now. Thanks for the quick help! :)
Guido