blogotext
blogotext copied to clipboard
wrong URL at file upload
When you upload a file, the URL proposed integration code is wrong.
- Upload file.odt
- The url shown is [url]/Blog/files/3e/file.odt[/url]. It's wrong
- The file is infact located at /Blog/files/file.odt
It seems to be a mistake in db register.
This only affects files, not images.
Hum ... I run some test with differents files (.odt) on my side, nothing. This is just for 1 file or all file ?
From what I see, the file type (image, document ...) is based on the extension of the file. Depends on the file type, the file path use URL_IMAGES or URL_DOCUMENTS can you test this ?
var_dump(URL_DOCUMENTS);
var_dump(URL_IMAGES);
It was with only one file, a .odt document. Where should I put this code?
can you try to replace your admin/fichiers.php
with this
and take a look at your file (with URl like admin/fichiers.php?file_id={file ID}&edit
)
Thanks. Here is the return :
string(22) "File name : oukile.odt" string(20) "File extension : odt" string(34) "Type from function : text_document" string(28) "Type from db : text_document" string(18) "Is image ? : false" string(46) "URL_IMAGES : https://yeuxdelibad.net/Blog/img/" string(51) "URL_DOCUMENTS : https://yeuxdelibad.net/Blog/files/" string(23) "$myFile['bt_path'] : 3e" string(40) "$urlRelative : /Blog/files/3e/oukile.odt" string(63) "$urlAbsolute : https://yeuxdelibad.net/Blog/files/3e/oukile.odt"
The file is in /Blog/files/oukile.odt and not in /Blog/files/3e/oukile.odt
From what I see (haven't take seriously an eye on the file upload process yet),
$myFile['bt_path']
seem's to be the problem.
I suppose, this var is set on file upload. BT try to guess the file type based on the file extension and, depends on the file type (image/doc) fill $myFile['bt_path']
with an empty or a subfolder name.
I try to take a look deeply in the file manager this W.E.
'bt_path' => ((empty($path)) ? (substr($checksum, 0, 2)) : $path ),
We should probably find a better way to generate links to patch it
Can we push this issue to BT 3.8 ?