Is it possible? This is with the model.
CUploadedFile::getInstance($model,'newsimage'); $model->image->saveAs("image\path")
but I don’t want to create a model to save my image.
What I really need is ... well, I'm trying to get CKEditor's "Upload Image" function to work, but I need a script to save the image. When I click on the “Download Image” button, I simply invoke the action, and from there I have access to the image that I selected using $_FILES
, but I cannot save the file to the destination directory.
Is it possible to save the file to the target path (for example, C: \ myProject \ images) and not use the model?
EDIT:
Here is the solution I found a bit later. The download file is in $_FILES['upload']
, so ..
$temp = CUploadedFile::getInstanceByName("upload"); // gets me the file into this variable ( i gues this wont work for multiple files at the same time ) $temp->saveAs("D:/games/" . $temp->name); // full name , including the filename too.
source share