Jump to content


url missing when i upload a file

upload file url

  • Please log in to reply
3 replies to this topic

#1 Juampi Mayoral

Juampi Mayoral

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 October 2012 - 02:56 PM

Hi guys! I'm having a problem when I change the url file. The Post response it's ok when i save, but when i return to the list, the url file link it's broken.

This is my Post response when i upload the file:

{"success":true,"files":[{"name":"64c32-b7920-Personal_6250.pdf","size":21896,"type":"application\/pdf","url":"http:\/\/localhost\/controlate\/assets\/uploads\/files\/2012\/Octubre\/64c32-b7920-Personal_6250.pdf"}]}

In my computer was successfuly saved, but when i go to the list, the url file it's like this:

http://localhost/controlate//64c32-b7920-Personal_6250.pdf

and it should be like this:

http://localhost/controlate/assets/uploads/files/2012/Octubre/64c32-b7920-Personal_6250.pdf

How can I change this file link before saving the data?

Any help?ยก? thanks! :D

#2 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 16 October 2012 - 09:19 PM

HI!
As I see your upload path is based on the date (from your previous topic).
You can create an extra field "path" in your table.
When you save a file, you should to insert the path into this field.
when you show a list you can use a callback_column :
return $row->path."/".$row->image
.
P.S My English is bad))

#3 Juampi Mayoral

Juampi Mayoral

    Member

  • Members
  • PipPip
  • 12 posts

Posted 18 October 2012 - 01:20 PM

Thanks Victor for your reply! I tried your code but I'm getting an error:

Undefined property: stdClass::$image

when I return $row->path.'/'.$row->image

#4 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 18 October 2012 - 03:17 PM

'images' is an extra field where you should keep image's name.





Also tagged with one or more of these keywords: upload, file, url

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users