Yii Framework Forum: Upload a file and save the link - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Upload a file and save the link Rate Topic: -----

#1 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 06 April 2009 - 05:06 AM

My model is composed by some text fields and an image. In the database the image is not saved like a blob field but like a text field. So when I uploaded the file I want to store the file link.

I found a cookbook tutorial that explain how to upload an image http://www.yiiframew...doc/cookbook/2/ but I have some questions.

Where can i find the method saveAs ? How this method save the file? ( have I to pass only the folder path or the folder path plus the file name to store? )

So my problem is: I have to store the file, take the url where the file is stored and save it into the database.

Some hints?



0

#2 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 06 April 2009 - 05:34 AM

Ok i make some tests and it's ok :D i resolve myself my problems :P

Thank you anyway :)
0

#3 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 06 April 2009 - 05:49 AM

ok to stay in topic. Yii offer something to autoresize the image?
0

#4 User is offline   letscode 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 05-January 09

Posted 06 April 2009 - 02:46 PM

No, Yii doesn't offer this. You can use this extension: Kohana Image library
0

#5 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 06 April 2009 - 05:22 PM

Infact i used it :D Thank you very much anyway :)
0

#6 User is offline   jiaming 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 262
  • Joined: 10-April 12

Posted 15 April 2012 - 11:59 PM

View PostStErMi, on 06 April 2009 - 05:34 AM, said:

Ok i make some tests and it's ok :D i resolve myself my problems :P

Thank you anyway :)


Can you give me some hints that how did you do that???

I am facing the same problem.

And how do you access the picture in your view page?

Best,
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users