⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

url missing when i upload a file



Juampi Mayoral
  • profile picture
  • Member

Posted 16 October 2012 - 14: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/[font=monospace]assets/uploads/files/2012/Octubre[/font]/64c32-b7920-Personal_6250.pdf

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

Any help?¡? thanks! :D

victor
  • profile picture
  • Member

Posted 16 October 2012 - 21: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))

Juampi Mayoral
  • profile picture
  • Member

Posted 18 October 2012 - 13:20 PM

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

[color=#000000][font=Arial, Helvetica, sans-serif][size=2]Undefined property: stdClass::$image [/size][/font][/color]

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

victor
  • profile picture
  • Member

Posted 18 October 2012 - 15:17 PM

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