Jump to content
php.lv forumi
Sign in to follow this  
vitalja

Kohana Upload::save()

Recommended Posts

		/*
			$image == $_FILES['image'] (array)
			$directory == 'uploads/' (string)
		*/ 
if ($file = Upload::save($image, NULL, $directory))
		{
			$this->message = $file;
			
			 $this->filename = strtolower(Text::random('alnum', 20)).'.jpg';
			Image::factory($file)
			->resize(200, 200, Image::AUTO)
			->save($directory.$this->filename);
			// Delete the temporary file
			unlink($file);
			return $this->filename;
			
		}

Labdien! Vai kāds varētu paskaidrot kāpēc nestrādā if statementa rindiņa, jeb Upload::save($image, NULL, $directory)

bootstrap.php failā esmu aktivizējis image moduli.

Share this post


Link to post
Share on other sites

Nu, piemēram, direktorijai kurā tu saglabā nav tiesību rakstīts. Vai arī tā neeksitē. Bet nu šitā var ilgi zīlēt kafijas biezumos. Jāskatās kādu kļūdas paziņojumu izmet

Share this post


Link to post
Share on other sites

ErrorException [ 8 ]: Array to string conversion ~ SYSPATH/classes/Kohana/Log/Writer.php [ 81 ]

 

Nezinu iespējams var kautkādā veidā ieslēgt normālos errorus, bet man nav izdevies to izdarīt, šis errors man parasti uzrādas sintakses kļudās.

Savāds errors, jo system mapi es vispār neesmu aizticis.

Share this post


Link to post
Share on other sites

Nafig 5.3? Varbūt labāk Kohana apdeitot? BTW, viņu issue tracker met 502, kaut kā nesmuki sanāk...

Edited by jurchiks

Share this post


Link to post
Share on other sites

Atrisināts!

Tas komentārs par error palīdzēja es atradu veidu kā uzlikt skaidrākus error. bootstrap.php failā Kohana::init(array(.. vajadzēja error => False, un tad skaidrajā errorā es sapratu, ka chmod vajadzēja nomainīt.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...