Search the Community
Showing results for tags 'phalcon'.
-
Hi: Am not sure if this is the best algorithm to go about saving a record and uploading (plus moving to another directory) files. I feel i need another algorithm? if (self::post()->isPost()) { #check if there is any file if($this->request->hasFiles() == true){ $uploads = $this->request->getUploadedFiles(); $isUploaded = false; #do a loop to handle each file individually foreach($uploads as $upload){ #define a "unique" name and a path to where our file must go $path = 'temp/'.md5(uniqid(rand(), true)).'-'.strtolower($upload->getname()); #move the file and simultaneously check if everything was ok if($upload->moveTo($path)) { #Build an array to be sent to the API for moving the uploaded file to front end directory $files=""; $files = array( 'name' => $upload->getName(), 'link' => $this->di['url']->get('temp/' . $upload->getName()), 'direction' => 'adverts' ); $saveResult = self::request()->request('move-advert/', array('file' => $files), 'POST'); if($saveResult->response == 'success') $isUploaded = true; else $isUploaded = false; } } #if any file couldn't be moved, then throw an message if($isUploaded) { $save_response = self::request()->request('advert/' . $id, self::editValues(self::post()->getPost()), 'POST'); if ($save_response->response == 'success') { $this->flashSession->success('Advert Updated'); return $this->response->redirect('adverts/list-adverts'); } else { $this->flashSession->notice('Could not update Advert'); } } else { $this->flashSession->notice('Some error ocurred. Please try again'); } }else { $this->flashSession->notice('You must Choose an advert image'); } } Any suggestions?
-
I am using phalcon framework and am trying to upload a file but hasFiles() returns nothing or false yet there are posted file. if($this->request->hasFiles() == true){ // echo "sdfsf"; exit(); ..... I cant go through that if statement.. Thanks in advance.
-
I am currently recruiting for a number of fantastic PHP Developer roles in Germany (English or German speakers) of all levels (Junior, Mid-Level, Senior, Technical Lead) to work with some impressive companies within a variety of industries in Munich, Berlin and Hamburg. Salaries ranging from €40,000 - €75,000 (Depending on experience). Are you considering new opportunities at the moment? Please contact me for further information and to take the first step towards your new role! gemma.bowron@quantica-technology.co.uk