QImageFileAsset: How do I move the UPLOADED File to another location
Sat, 06/19/2010 - 14:44
Hello All,
Please one of my friends just did a QForm with a QImageFileAsset to upload files. After uploads, please is there a method to move the uploaded file to another location within his application. If no method exist, please show me a sample code on how to do this.
Thanks.

Profnotime
Use the Copy Command.
This should work.
// move the picture to the new directory
if ($this->flaPicture1->File) {
copy($this->flaPicture1->File, __DOCROOT__ . __USER_IMAGE_ASSETS__ . '/' . $this->flaPicture1->FileName);
// Assign the file name to the field Page->Picture1
$this->mctPage->Page->Picture1 = $this->flaPicture1->FileName ;
}
1. flaPicture1 is container for the image I uploaded with the QImageFileAsset
2. __USER_IMAGE_ASSETS__ is a directory that I defined in the configuration file. You can hard code the directory
3. make sure the receiving directory is writable on your server.
Hope this helps.
David
Yeah it sure does. Thanks very much. However, do I need to delete the copy the TemporaryPath after this or does QCubed handle this for me?
Do a move() instead of copy() if in doubt.
tnk all...i happen to be in dis condition...tnks for d support!